<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
  <meta name="theme-color" content="#222">
  <meta name="generator" content="Hexo 4.2.1">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
  <link rel="mask-icon" href="/images/safari-pinned-tab.svg" color="#222">
  <link rel="stylesheet" href="/css/main.css">
  <link rel="stylesheet" href="/lib/font-awesome/css/all.min.css">
  <link rel="stylesheet" href="/lib/pace/pace-theme-minimal.min.css">
  <script src="/lib/pace/pace.min.js"></script>
  <script id="hexo-configurations">
    var NexT = window.NexT ||
    {};
    var CONFIG = {
      "hostname": "cuiqingcai.com",
      "root": "/",
      "scheme": "Pisces",
      "version": "7.8.0",
      "exturl": false,
      "sidebar":
      {
        "position": "right",
        "width": 360,
        "display": "post",
        "padding": 18,
        "offset": 12,
        "onmobile": false,
        "widgets": [
          {
            "type": "image",
            "name": "阿布云",
            "enable": false,
            "url": "https://www.abuyun.com/http-proxy/introduce.html",
            "src": "https://qiniu.cuiqingcai.com/88au8.jpg",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "天验",
            "enable": true,
            "url": "https://tutorial.lengyue.video/?coupon=12ef4b1a-a3db-11ea-bb37-0242ac130002_cqx_850",
            "src": "https://qiniu.cuiqingcai.com/bco2a.png",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "华为云",
            "enable": false,
            "url": "https://activity.huaweicloud.com/2020_618_promotion/index.html?bpName=5f9f98a29e2c40b780c1793086f29fe2&bindType=1&salesID=wangyubei",
            "src": "https://qiniu.cuiqingcai.com/y42ik.jpg",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "张小鸡",
            "enable": false,
            "url": "http://www.zxiaoji.com/",
            "src": "https://qiniu.cuiqingcai.com/fm72f.png",
            "width": "100%"
      },
          {
            "type": "image",
            "name": "Luminati",
            "src": "https://qiniu.cuiqingcai.com/ikkq9.jpg",
            "url": "https://luminati-china.io/?affiliate=ref_5fbbaaa9647883f5c6f77095",
            "width": "100%",
            "enable": false
      },
          {
            "type": "image",
            "name": "IPIDEA",
            "url": "http://www.ipidea.net/?utm-source=cqc&utm-keyword=?cqc",
            "src": "https://qiniu.cuiqingcai.com/0ywun.png",
            "width": "100%",
            "enable": true
      },
          {
            "type": "tags",
            "name": "标签云",
            "enable": true
      },
          {
            "type": "categories",
            "name": "分类",
            "enable": true
      },
          {
            "type": "friends",
            "name": "友情链接",
            "enable": true
      },
          {
            "type": "hot",
            "name": "猜你喜欢",
            "enable": true
      }]
      },
      "copycode":
      {
        "enable": true,
        "show_result": true,
        "style": "mac"
      },
      "back2top":
      {
        "enable": true,
        "sidebar": false,
        "scrollpercent": true
      },
      "bookmark":
      {
        "enable": false,
        "color": "#222",
        "save": "auto"
      },
      "fancybox": false,
      "mediumzoom": false,
      "lazyload": false,
      "pangu": true,
      "comments":
      {
        "style": "tabs",
        "active": "gitalk",
        "storage": true,
        "lazyload": false,
        "nav": null,
        "activeClass": "gitalk"
      },
      "algolia":
      {
        "hits":
        {
          "per_page": 10
        },
        "labels":
        {
          "input_placeholder": "Search for Posts",
          "hits_empty": "We didn't find any results for the search: ${query}",
          "hits_stats": "${hits} results found in ${time} ms"
        }
      },
      "localsearch":
      {
        "enable": true,
        "trigger": "auto",
        "top_n_per_article": 10,
        "unescape": false,
        "preload": false
      },
      "motion":
      {
        "enable": false,
        "async": false,
        "transition":
        {
          "post_block": "bounceDownIn",
          "post_header": "slideDownIn",
          "post_body": "slideDownIn",
          "coll_header": "slideLeftIn",
          "sidebar": "slideUpIn"
        }
      },
      "path": "search.xml"
    };

  </script>
  <meta name="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
  <meta property="og:type" content="website">
  <meta property="og:title" content="静觅">
  <meta property="og:url" content="https://cuiqingcai.com/page/30/index.html">
  <meta property="og:site_name" content="静觅">
  <meta property="og:description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
  <meta property="og:locale" content="zh_CN">
  <meta property="article:author" content="崔庆才">
  <meta property="article:tag" content="崔庆才">
  <meta property="article:tag" content="静觅">
  <meta property="article:tag" content="PHP">
  <meta property="article:tag" content="Java">
  <meta property="article:tag" content="Python">
  <meta property="article:tag" content="Spider">
  <meta property="article:tag" content="爬虫">
  <meta property="article:tag" content="Web">
  <meta property="article:tag" content="Kubernetes">
  <meta property="article:tag" content="深度学习">
  <meta property="article:tag" content="机器学习">
  <meta property="article:tag" content="数据分析">
  <meta property="article:tag" content="网络">
  <meta property="article:tag" content="IT">
  <meta property="article:tag" content="技术">
  <meta property="article:tag" content="博客">
  <meta name="twitter:card" content="summary">
  <link rel="canonical" href="https://cuiqingcai.com/page/30/">
  <script id="page-configurations">
    // https://hexo.io/docs/variables.html
    CONFIG.page = {
      sidebar: "",
      isHome: true,
      isPost: false,
      lang: 'zh-CN'
    };

  </script>
  <title>静觅丨崔庆才的个人站点</title>
  <meta name="google-site-verification" content="p_bIcnvirkFzG2dYKuNDivKD8-STet5W7D-01woA2fc" />
  <noscript>
    <style>
      .use-motion .brand,
      .use-motion .menu-item,
      .sidebar-inner,
      .use-motion .post-block,
      .use-motion .pagination,
      .use-motion .comments,
      .use-motion .post-header,
      .use-motion .post-body,
      .use-motion .collection-header
      {
        opacity: initial;
      }

      .use-motion .site-title,
      .use-motion .site-subtitle
      {
        opacity: initial;
        top: initial;
      }

      .use-motion .logo-line-before i
      {
        left: initial;
      }

      .use-motion .logo-line-after i
      {
        right: initial;
      }

    </style>
  </noscript>
  <link rel="alternate" href="/atom.xml" title="静觅" type="application/atom+xml">
</head>

<body itemscope itemtype="http://schema.org/WebPage">
  <div class="container">
    <div class="headband"></div>
    <header class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner">
        <div class="site-brand-container">
          <div class="site-nav-toggle">
            <div class="toggle" aria-label="切换导航栏">
              <span class="toggle-line toggle-line-first"></span>
              <span class="toggle-line toggle-line-middle"></span>
              <span class="toggle-line toggle-line-last"></span>
            </div>
          </div>
          <div class="site-meta">
            <a href="/" class="brand" rel="start">
              <span class="logo-line-before"><i></i></span>
              <h1 class="site-title">静觅 <span class="site-subtitle"> 崔庆才的个人站点 </span>
              </h1>
              <span class="logo-line-after"><i></i></span>
            </a>
          </div>
          <div class="site-nav-right">
            <div class="toggle popup-trigger">
              <i class="fa fa-search fa-fw fa-lg"></i>
            </div>
          </div>
        </div>
        <nav class="site-nav">
          <ul id="menu" class="main-menu menu">
            <li class="menu-item menu-item-home">
              <a href="/" rel="section">首页</a>
            </li>
            <li class="menu-item menu-item-archives">
              <a href="/archives/" rel="section">文章列表</a>
            </li>
            <li class="menu-item menu-item-tags">
              <a href="/tags/" rel="section">文章标签</a>
            </li>
            <li class="menu-item menu-item-categories">
              <a href="/categories/" rel="section">文章分类</a>
            </li>
            <li class="menu-item menu-item-about">
              <a href="/about/" rel="section">关于博主</a>
            </li>
            <li class="menu-item menu-item-message">
              <a href="/message/" rel="section">给我留言</a>
            </li>
            <li class="menu-item menu-item-search">
              <a role="button" class="popup-trigger">搜索 </a>
            </li>
          </ul>
        </nav>
        <div class="search-pop-overlay">
          <div class="popup search-popup">
            <div class="search-header">
              <span class="search-icon">
                <i class="fa fa-search"></i>
              </span>
              <div class="search-input-container">
                <input autocomplete="off" autocapitalize="off" placeholder="搜索..." spellcheck="false" type="search" class="search-input">
              </div>
              <span class="popup-btn-close">
                <i class="fa fa-times-circle"></i>
              </span>
            </div>
            <div id="search-result">
              <div id="no-result">
                <i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>
              </div>
            </div>
          </div>
        </div>
      </div>
    </header>
    <div class="back-to-top">
      <i class="fa fa-arrow-up"></i>
      <span>0%</span>
    </div>
    <div class="reading-progress-bar"></div>
    <main class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div class="content index posts-expand">
            <div class="carousel">
              <div id="wowslider-container">
                <div class="ws_images">
                  <ul>
                    <li><a target="_blank" href="https://cuiqingcai.com/5052.html"><img title="Python3网络爬虫开发实战教程" src="https://qiniu.cuiqingcai.com/ipy96.jpg" /></a></li>
                    <li><a target="_blank" href="https://t.lagou.com/fRCBRsRCSN6FA"><img title="52讲轻松搞定网络爬虫" src="https://qiniu.cuiqingcai.com/fqq5e.png" /></a></li>
                    <li><a target="_blank" href="https://brightdata.grsm.io/cuiqingcai"><img title="亮网络解锁器" src="https://qiniu.cuiqingcai.com/6qnb7.png" /></a></li>
                    <li><a target="_blank" href="https://cuiqingcai.com/4320.html"><img title="Python3网络爬虫开发视频教程" src="https://qiniu.cuiqingcai.com/bjrny.jpg" /></a></li>
                    <li><a target="_blank" href="https://cuiqingcai.com/5094.html"><img title="爬虫代理哪家强？十大付费代理详细对比评测出炉！" src="https://qiniu.cuiqingcai.com/nifs6.jpg" /></a></li>
                  </ul>
                </div>
                <div class="ws_thumbs">
                  <div>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/ipy96.jpg" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/fqq5e.png" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/6qnb7.png" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/bjrny.jpg" /></a>
                    <a target="_blank" href="#"><img src="https://qiniu.cuiqingcai.com/nifs6.jpg" /></a>
                  </div>
                </div>
                <div class="ws_shadow"></div>
              </div>
            </div>
            <link rel="stylesheet" href="/lib/wowslide/slide.css">
            <script src="/lib/wowslide/jquery.min.js"></script>
            <script src="/lib/wowslide/slider.js"></script>
            <script>
              jQuery("#wowslider-container").wowSlider(
              {
                effect: "cube",
                prev: "",
                next: "",
                duration: 20 * 100,
                delay: 20 * 100,
                width: 716,
                height: 297,
                autoPlay: true,
                playPause: true,
                stopOnHover: false,
                loop: false,
                bullets: 0,
                caption: true,
                captionEffect: "slide",
                controls: true,
                onBeforeStep: 0,
                images: 0
              });

            </script>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/431.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/431.html" class="post-title-link" itemprop="url">Redis常用命令总结</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="一、字符串"><a href="#一、字符串" class="headerlink" title="一、字符串"></a>一、字符串</h2>
                  <p>以实际输入的命令为例</p>
                  <h3 id="1-建立键值对"><a href="#1-建立键值对" class="headerlink" title="1.建立键值对"></a>1.建立键值对</h3>
                  <figure class="highlight gams">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">set</span> bar <span class="comment">1</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>建立了一个键值对，键名叫bar，键值是1</p>
                  <h3 id="2-判断键是否存在"><a href="#2-判断键是否存在" class="headerlink" title="2.判断键是否存在"></a>2.判断键是否存在</h3>
                  <figure class="highlight arduino">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">exists</span> bar</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>判断键名bar是否存在 若存在则返回1,不存在返回0</p>
                  <h3 id="3-删除键"><a href="#3-删除键" class="headerlink" title="3.删除键"></a>3.删除键</h3>
                  <figure class="highlight dos">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">del</span> bar</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>删除键名为bar的键值对 若删除成功则返回删除的个数,删除失败(不存在)则返回0</p>
                  <h3 id="4-查看所有的键"><a href="#4-查看所有的键" class="headerlink" title="4.查看所有的键"></a>4.查看所有的键</h3>
                  <figure class="highlight livecodeserver">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">keys</span> *</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="5-获得键值的数据类型"><a href="#5-获得键值的数据类型" class="headerlink" title="5.获得键值的数据类型"></a>5.获得键值的数据类型</h3>
                  <figure class="highlight elm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">type</span> foo</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>获得键名为foo的键值类型 返回值类型可能有 string(字符串),hash(散列),list(列表),set(集合),zset(有序集合)</p>
                  <h3 id="6-获得键对应的值"><a href="#6-获得键对应的值" class="headerlink" title="6.获得键对应的值"></a>6.获得键对应的值</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="builtin-name">get</span> foo</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>获得键名为foo的键值</p>
                  <h3 id="7-自增"><a href="#7-自增" class="headerlink" title="7.自增"></a>7.自增</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">incr foo</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>创建一个foo的键值对，并自增为1 但是运行type foo 时，显示为string 增加特定数值</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">incrby foo <span class="number">3</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>使foo增加3</p>
                  <h3 id="8-自减"><a href="#8-自减" class="headerlink" title="8.自减"></a>8.自减</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">decr foo</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h4 id="减小1个数值"><a href="#减小1个数值" class="headerlink" title="减小1个数值"></a>减小1个数值</h4>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">decrby foo <span class="number">3</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h4 id="减小3个数值"><a href="#减小3个数值" class="headerlink" title="减小3个数值"></a>减小3个数值</h4>
                  <h3 id="9-增加指定浮点数"><a href="#9-增加指定浮点数" class="headerlink" title="9.增加指定浮点数"></a>9.增加指定浮点数</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">incrbyfloat bar <span class="number">2.5</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>bar增加指定的浮点数2.5</p>
                  <h3 id="10-向尾部追加值"><a href="#10-向尾部追加值" class="headerlink" title="10.向尾部追加值"></a>10.向尾部追加值</h3>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">append</span> <span class="keyword">bar </span>hehe</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">append</span> <span class="keyword">bar </span><span class="string">" world"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>如果是要追加带空格的内容，则要用空格引起来 返回值是一个数字，代表现在键值的长度</p>
                  <h3 id="11-获取字符串长度"><a href="#11-获取字符串长度" class="headerlink" title="11.获取字符串长度"></a>11.获取字符串长度</h3>
                  <figure class="highlight gauss">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="built_in">strlen</span> <span class="built_in">bar</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>返回值是一个数字，代表现在的字符串长度</p>
                  <h3 id="12-同时设置多个键值对"><a href="#12-同时设置多个键值对" class="headerlink" title="12.同时设置多个键值对"></a>12.同时设置多个键值对</h3>
                  <figure class="highlight ceylon">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">mset key<span class="number">1</span> <span class="keyword">value</span><span class="number">1</span> key<span class="number">2</span> <span class="keyword">value</span><span class="number">2</span> key<span class="number">3</span> <span class="keyword">value</span><span class="number">3</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="13-同时获得多个键值对应内容"><a href="#13-同时获得多个键值对应内容" class="headerlink" title="13.同时获得多个键值对应内容"></a>13.同时获得多个键值对应内容</h3>
                  <figure class="highlight nginx">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">mget</span> key1 key2</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="number">1</span>)value1</span><br><span class="line"><span class="number">2</span>)value2</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="二、散列"><a href="#二、散列" class="headerlink" title="二、散列"></a>二、散列</h2>
                  <h3 id="1-赋值和取值"><a href="#1-赋值和取值" class="headerlink" title="1.赋值和取值"></a>1.赋值和取值</h3>
                  <figure class="highlight q">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">hset <span class="built_in">key</span> field <span class="built_in">value</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>例如:</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">hset car price <span class="number">500</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">hget car price</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>同时赋值多个字段的值</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">hmset car price <span class="number">500</span> name BMW</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">hmget car price <span class="built_in">name</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="2-判断字段是否存在"><a href="#2-判断字段是否存在" class="headerlink" title="2.判断字段是否存在"></a>2.判断字段是否存在</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">hexists car price</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="3-只获得字段名"><a href="#3-只获得字段名" class="headerlink" title="3.只获得字段名"></a>3.只获得字段名</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">hkeys car</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="4-只获得字段值"><a href="#4-只获得字段值" class="headerlink" title="4.只获得字段值"></a>4.只获得字段值</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">hvals car</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="5-获得字段数量"><a href="#5-获得字段数量" class="headerlink" title="5.获得字段数量"></a>5.获得字段数量</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">hlen key</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="三、列表"><a href="#三、列表" class="headerlink" title="三、列表"></a>三、列表</h2>
                  <h3 id="1-向两边添加元素"><a href="#1-向两边添加元素" class="headerlink" title="1.向两边添加元素"></a>1.向两边添加元素</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lpush<span class="built_in"> group </span>1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">rpush<span class="built_in"> group </span>2</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果</p>
                  <figure class="highlight lsl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="number">1</span>) <span class="string">"1"</span> </span><br><span class="line"><span class="number">2</span>) <span class="string">"2"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>lpush 是向左边添加元素，rpush 是向右边添加元素。</p>
                  <h3 id="2-从两边弹出元素"><a href="#2-从两边弹出元素" class="headerlink" title="2. 从两边弹出元素"></a>2. 从两边弹出元素</h3>
                  <figure class="highlight axapta">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lpop <span class="keyword">group</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight axapta">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">rpop <span class="keyword">group</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>lpop 是从左边弹出元素， rpop 是从右边弹出元素，显示元素的值</p>
                  <h3 id="3-获取列表中元素的个数"><a href="#3-获取列表中元素的个数" class="headerlink" title="3.获取列表中元素的个数"></a>3.获取列表中元素的个数</h3>
                  <figure class="highlight axapta">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">llen <span class="keyword">group</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="4-获得列表片段"><a href="#4-获得列表片段" class="headerlink" title="4.获得列表片段"></a>4.获得列表片段</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lrange<span class="built_in"> group </span>0 3</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lrange<span class="built_in"> group </span>-2 -1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>其中 -2 -1 为负索引，这个也是可行的。-2代表倒数第二个元素，-1代表倒数第一个元素。 特殊地：获取所有元素则可以这么写</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lrange<span class="built_in"> group </span>0 -1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="5-删除列表中指定的值"><a href="#5-删除列表中指定的值" class="headerlink" title="5.删除列表中指定的值"></a>5.删除列表中指定的值</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lrem<span class="built_in"> group </span>count value</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>当count &gt; 0，它会从左边开始删除前count个值为value的元素。 当count &lt; 0，它会从右边开始删除前|count|个值为value的元素。 但count = 0，它会删除所有值为value的元素。</p>
                  <h3 id="6-获得索引处的值"><a href="#6-获得索引处的值" class="headerlink" title="6.获得索引处的值"></a>6.获得索引处的值</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lindex<span class="built_in"> group </span>0</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>获得索引0位置的元素值</p>
                  <h3 id="7-设置索引处的值"><a href="#7-设置索引处的值" class="headerlink" title="7.设置索引处的值"></a>7.设置索引处的值</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">lset<span class="built_in"> group </span>1 5</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>将 group 索引 1 处的值改为 5</p>
                  <h3 id="8-只保留特定的片段"><a href="#8-只保留特定的片段" class="headerlink" title="8.只保留特定的片段"></a>8.只保留特定的片段</h3>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">ltrim<span class="built_in"> group </span>0 1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>只保留索引0到1的值，其余的删除</p>
                  <h3 id="9-向列表中插入元素"><a href="#9-向列表中插入元素" class="headerlink" title="9.向列表中插入元素"></a>9.向列表中插入元素</h3>
                  <figure class="highlight tcl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">linsert</span> group <span class="keyword">after</span> <span class="number">2</span> <span class="number">5</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>从左边开始查询，找到数字2，在后面插入数字5 insert group before 2 5 从左边开始查询，找到数字2，在前面插入数字5</p>
                  <h2 id="四、集合"><a href="#四、集合" class="headerlink" title="四、集合"></a>四、集合</h2>
                  <h3 id="1-添加元素"><a href="#1-添加元素" class="headerlink" title="1.添加元素"></a>1.添加元素</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sadd hello <span class="number">2</span> <span class="number">4</span> <span class="number">5</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>向集合中添加2 4 5元素，返回值是成功加入的元素数量</p>
                  <h3 id="2-删除元素"><a href="#2-删除元素" class="headerlink" title="2.删除元素"></a>2.删除元素</h3>
                  <p>srem hello 4 5 从集合中删除4 5，返回值是成功删除的元素数量</p>
                  <h3 id="3-获得集合中所有元素"><a href="#3-获得集合中所有元素" class="headerlink" title="3.获得集合中所有元素"></a>3.获得集合中所有元素</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">smembers hello</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="4-判断元素是否在集合中"><a href="#4-判断元素是否在集合中" class="headerlink" title="4.判断元素是否在集合中"></a>4.判断元素是否在集合中</h3>
                  <p>sismember hello 2 判断2是否在集合hello中 存在返回1，不存在返回0</p>
                  <h3 id="5-集合的运算"><a href="#5-集合的运算" class="headerlink" title="5.集合的运算"></a>5.集合的运算</h3>
                  <h4 id="差集"><a href="#差集" class="headerlink" title="差集"></a>差集</h4>
                  <figure class="highlight jboss-cli">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sdiff <span class="keyword">set</span>A <span class="keyword">set</span>B</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>返回值是集合，返回的是存在集合A中但是不存在B中的元素集合</p>
                  <h4 id="交集"><a href="#交集" class="headerlink" title="交集"></a>交集</h4>
                  <figure class="highlight jboss-cli">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sinter <span class="keyword">set</span>A <span class="keyword">set</span>B</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>返回值是setA和setB的交集</p>
                  <h4 id="并集"><a href="#并集" class="headerlink" title="并集"></a>并集</h4>
                  <figure class="highlight jboss-cli">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sunion <span class="keyword">set</span>A <span class="keyword">set</span>B</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="6-获得集合大小"><a href="#6-获得集合大小" class="headerlink" title="6.获得集合大小"></a>6.获得集合大小</h3>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">scard</span> <span class="meta">setA</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>返回值是数目</p>
                  <h3 id="7-随机获得集合中的数字"><a href="#7-随机获得集合中的数字" class="headerlink" title="7.随机获得集合中的数字"></a>7.随机获得集合中的数字</h3>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">srandmember</span> <span class="meta">setA</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="五、有序集合"><a href="#五、有序集合" class="headerlink" title="五、有序集合"></a>五、有序集合</h2>
                  <h3 id="1-增加元素"><a href="#1-增加元素" class="headerlink" title="1.增加元素"></a>1.增加元素</h3>
                  <p>增加时需要指定元素的分数和元素的名称</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zadd score <span class="number">89</span> Tom <span class="number">45</span> Amy</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>分数不仅可以是整数，还可以是浮点数</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zadd score <span class="number">2.3</span> Mike</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight stata">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zadd <span class="keyword">score</span> +<span class="keyword">inf</span> Bob</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="2-获得元素分数"><a href="#2-获得元素分数" class="headerlink" title="2.获得元素分数"></a>2.获得元素分数</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">zscore score Tom</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>如果不存在，返回(nil)</p>
                  <h3 id="3-获得排名在某个范围内的元素列表"><a href="#3-获得排名在某个范围内的元素列表" class="headerlink" title="3.获得排名在某个范围内的元素列表"></a>3.获得排名在某个范围内的元素列表</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zrange score <span class="number">0</span> <span class="number">2</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>带分数显示</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zrange score <span class="number">0</span> <span class="number">-1</span> withscores</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="4-获得指定分数范围的元素"><a href="#4-获得指定分数范围的元素" class="headerlink" title="4.获得指定分数范围的元素"></a>4.获得指定分数范围的元素</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zrangebyscore score <span class="number">45</span> <span class="number">80</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>获得45分到80分的元素，闭区间 如果不想是闭区间，则可以在索引前面加上（</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zrangebyscore score (<span class="number">45</span> <span class="number">80</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="5-取某几个值"><a href="#5-取某几个值" class="headerlink" title="5.取某几个值"></a>5.取某几个值</h3>
                  <p>zrangebyscore score (45 80 limit 0 3 取(45,80]之间的元素，从第一个开始，取3个</p>
                  <h3 id="6-增加某个元素分数"><a href="#6-增加某个元素分数" class="headerlink" title="6.增加某个元素分数"></a>6.增加某个元素分数</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zincrby score <span class="number">5</span> Tom</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>给某个元素加5分</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zincrby score <span class="number">-2</span> Tom</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>给某个元素减2分</p>
                  <h3 id="7-给某个元素重新赋值分数"><a href="#7-给某个元素重新赋值分数" class="headerlink" title="7.给某个元素重新赋值分数"></a>7.给某个元素重新赋值分数</h3>
                  <p>同样用zadd命令</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zadd score <span class="number">22</span> Tom</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="8-获得集合中元素的数量"><a href="#8-获得集合中元素的数量" class="headerlink" title="8.获得集合中元素的数量"></a>8.获得集合中元素的数量</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">zcard score</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="9-获得指定分数范围内元素个数"><a href="#9-获得指定分数范围内元素个数" class="headerlink" title="9.获得指定分数范围内元素个数"></a>9.获得指定分数范围内元素个数</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zcount score <span class="number">79</span> <span class="number">90</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="10-删除一个或者多个元素"><a href="#10-删除一个或者多个元素" class="headerlink" title="10.删除一个或者多个元素"></a>10.删除一个或者多个元素</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">zrem score Tom</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h3 id="11-按照分数删除元素"><a href="#11-按照分数删除元素" class="headerlink" title="11.按照分数删除元素"></a>11.按照分数删除元素</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zremrangebyrank score <span class="number">0</span> <span class="number">1</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>它先会把它按照分数从小到大排列，然后删除索引位置的元素</p>
                  <h3 id="12-按照分数删除元素"><a href="#12-按照分数删除元素" class="headerlink" title="12.按照分数删除元素"></a>12.按照分数删除元素</h3>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">zremrangebyscore score <span class="number">28</span> <span class="number">99</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>他会删除指定分数范围内的元素</p>
                  <h3 id="13-获得元素排名"><a href="#13-获得元素排名" class="headerlink" title="13.获得元素排名"></a>13.获得元素排名</h3>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">zrank score Tom</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>获得按照分数从小到大排列后，Tom的索引位置 反向排名</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">zrevrank score Tom</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>返回从大到小排列后，Tom的索引位置</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-22 00:05:48" itemprop="dateCreated datePublished" datetime="2014-11-22T00:05:48+08:00">2014-11-22</time>
                </span>
                <span id="/431.html" class="post-meta-item leancloud_visitors" data-flag-title="Redis常用命令总结" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>2.5k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>2 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/423.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/423.html" class="post-title-link" itemprop="url">Git配置SSH,并Push到GitHub上的相关流程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>首先，你可以试着输入<code>git</code>，看看系统有没有安装Git</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$ git</span><br><span class="line">The program 'git' <span class="keyword">is</span> currently <span class="keyword">not</span> installed. You can install <span class="keyword">it</span> <span class="keyword">by</span> typing:</span><br><span class="line">sudo apt-<span class="keyword">get</span> install git</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>像上面的命令，有很多Linux会友好地告诉你Git没有安装，还会告诉你如何安装Git。 如果你碰巧用Debian或Ubuntu Linux，通过一条<code>sudo apt-get install git</code>就可以直接完成Git的安装，非常简单。 如果是其他Linux版本，可以直接通过源码安装。先从Git官网下载源码，然后解压，依次输入：<code>./config</code>，<code>make</code>，<code>sudo make install</code>这几个命令安装就好了。 安装完成后，还需要最后一步设置，在命令行输入：</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$ git<span class="built_in"> config </span>--global user.name <span class="string">"Your Name"</span></span><br><span class="line">$ git<span class="built_in"> config </span>--global user.email <span class="string">"email@example.com"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>然后我们需要配置SSH。 第1步：创建SSH Key。在用户主目录下，看看有没有.ssh目录，如果有，再看看这个目录下有没有<code>id_rsa</code>和<code>id_rsa.pub</code>这两个文件，如果已经有了，可直接跳到下一步。如果没有，打开Shell（Windows下打开Git Bash），创建SSH Key：</p>
                  <figure class="highlight elixir">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="variable">$ </span>ssh-keygen -t rsa -C <span class="string">"youremail@example.com"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>你需要把邮件地址换成你自己的邮件地址，然后一路回车，使用默认值即可，由于这个Key也不是用于军事目的，所以也无需设置密码。 如果一切顺利的话，可以在用户主目录里找到<code>.ssh</code>目录，里面有<code>id_rsa</code>和<code>id_rsa.pub</code>两个文件，这两个就是SSH Key的秘钥对，<code>id_rsa</code>是私钥，不能泄露出去，<code>id_rsa.pub</code>是公钥，可以放心地告诉任何人。 第2步：登陆GitHub，打开“Account settings”，“SSH Keys”页面： 然后，点“Add SSH Key”，填上任意Title，在Key文本框里粘贴<code>id_rsa.pub</code>文件的内容： <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/0.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/0.png" alt="0"></a> 点“Add Key”，你就应该看到已经添加的Key： <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/10.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/10.png" alt="10"></a> 为什么GitHub需要SSH Key呢？因为GitHub需要识别出你推送的提交确实是你推送的，而不是别人冒充的，而Git支持SSH协议，所以，GitHub只要知道了你的公钥，就可以确认只有你自己才能推送。 当然，GitHub允许你添加多个Key。假定你有若干电脑，你一会儿在公司提交，一会儿在家里提交，只要把每台电脑的Key都添加到GitHub，就可以在每台电脑上往GitHub推送了。 现在，我们根据GitHub的提示，在本地的<code>learngit</code>仓库下运行命令：</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$ git remote <span class="keyword">add</span><span class="bash"> origin git@github.com:cqcre/cqc.git</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>请千万注意，把上面的 cqcre 替换成你自己的GitHub账户名，否则，你在本地关联的就是我的远程库，关联没有问题，但是你以后推送是推不上去的，因为你的SSH Key公钥不在我的账户列表中。 添加后，远程库的名字就是<code>origin</code>，这是Git默认的叫法，也可以改成别的，但是<code>origin</code>这个名字一看就知道是远程库。 下一步，就可以把本地库的所有内容推送到远程库上：</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$ git <span class="built_in">push</span> -u <span class="built_in">origin</span> master</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>好啦，静静等待git把你的代码Push上去吧~是不是很简单？</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-21 01:23:25" itemprop="dateCreated datePublished" datetime="2014-11-21T01:23:25+08:00">2014-11-21</time>
                </span>
                <span id="/423.html" class="post-meta-item leancloud_visitors" data-flag-title="Git配置SSH,并Push到GitHub上的相关流程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.4k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/419.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> 福利专区 <i class="label-arrow"></i>
                  </a>
                  <a href="/419.html" class="post-title-link" itemprop="url">Cocos2d-x游戏开发视频学习教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>想学游戏开发吗？ 想把自己的创意变成现实吗？ 想一次开发，各个平台到处运行吗？ 想亲自体验一下开发的成果带给你的惊喜吗？ 玩过捕鱼达人么？这个游戏6不6？想不想自己做一个？ 那就选择Cocos2d-x游戏开发。在这里提供给小伙伴们全套的视频教程。 来自兄弟连的Cocos2d-x视频教程。 网盘地址：<a href="http://pan.baidu.com/s/1ntxCnbF" target="_blank" rel="noopener">http://pan.baidu.com/s/1ntxCnbF</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-20 20:34:45" itemprop="dateCreated datePublished" datetime="2014-11-20T20:34:45+08:00">2014-11-20</time>
                </span>
                <span id="/419.html" class="post-meta-item leancloud_visitors" data-flag-title="Cocos2d-x游戏开发视频学习教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>174</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/415.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> 福利专区 <i class="label-arrow"></i>
                  </a>
                  <a href="/415.html" class="post-title-link" itemprop="url">2013-14凯文杜兰特荣膺MVP颁奖仪式全程高清录像</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/u4149205911206726642fm11gp0.jpg" itemprop="contentUrl">
                </div>
                <div class="excerpt">
                  <p>
                  <p><a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/u4149205911206726642fm11gp0.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/u4149205911206726642fm11gp0.jpg" alt="u=414920591,1206726642&amp;fm=11&amp;gp=0"></a> 2013-2014赛季，杜兰特凭借其逆天表现勇夺MVP，下面为他加冕MVP的颁奖典礼及感言，全程录像，高清！ 网盘地址下载：<a href="http://pan.baidu.com/s/1qWymcnq" target="_blank" rel="noopener">http://pan.baidu.com/s/1qWymcnq</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-20 20:16:18" itemprop="dateCreated datePublished" datetime="2014-11-20T20:16:18+08:00">2014-11-20</time>
                </span>
                <span id="/415.html" class="post-meta-item leancloud_visitors" data-flag-title="2013-14凯文杜兰特荣膺MVP颁奖仪式全程高清录像" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>92</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/402.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/402.html" class="post-title-link" itemprop="url">Windows远程桌面连接Ubuntu方法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>今天想配置一下Linux服务器，实现在Windows下远程连接Ubuntu，查看远程桌面。我的是Ubuntu 14.04，就以此为例来配置。 由于xrdp、gnome和unity之间的兼容性问题，在Ubuntu 14.04版本中仍然无法使用xrdp登陆gnome或unity的远程桌面，现象是登录后只有黑白点为背景，无图标也无法操作。所以使用xrdp只能登录xfce的远程桌面。 也就是说单纯安装一个xrdp是无法进行远程桌面连接的。你看不到任何有效信息，桌面至少一个x箭头加一个黑白点的屏幕。 所以我们需要安装xfce 首先安装xfce：</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="keyword">get</span> <span class="keyword">update</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="builtin-name">get</span> install xfce4</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>xfce是一个在Unix与Unix-like操作系统 （如GNU/Linux、FreeBSD 和 Solaris）上运行的开源桌面环境，在远程桌面连接时我们会看到xfce桌面，但是无法看到Ubuntu中安装的原生桌面。换句话说，你远程连接看到的桌面和实际远程Ubuntu 14.04的桌面是不一样的。 但是它的文件系统和相关设置是通用的，只不过是样子不一样而已。 然后安装xrdp组件和vnc服务器：</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="builtin-name">get</span> install xrdp vnc4server</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>安装好后要自行新建配置文件，使得在远程登录时默认使用xfce作为界面登录，然后重启xrdp服务：</p>
                  <figure class="highlight jboss-cli">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">echo</span> <span class="string">"xfce4-session"</span> &gt;~<span class="string">/.xsession</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo<span class="built_in"> service </span>xrdp restart</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>好了，配置完以上内容，便可以在Windows下进行远程桌面连接了。 打开Windows下的远程桌面连接，输入目标IP地址，便会出现下面的界面。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141120185332.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141120185332.jpg" alt="QQ截图20141120185332"></a> 输入目标主机的用户名和密码，登录便可以查看到远程的桌面内容了，即xfce桌面。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141120185617.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141120185617-1024x575.jpg" alt="QQ截图20141120185617"></a> 小伙伴们，欢呼吧！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-20 19:00:55" itemprop="dateCreated datePublished" datetime="2014-11-20T19:00:55+08:00">2014-11-20</time>
                </span>
                <span id="/402.html" class="post-meta-item leancloud_visitors" data-flag-title="Windows远程桌面连接Ubuntu方法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>757</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/381.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/381.html" class="post-title-link" itemprop="url">怎样用PS把电子文档变成实拍纸张图</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>我想大家在生活中一定遇到这样的情况： 请把下面的文档打印出并签字然后拍照上传。 看到这句话我想大家都受不了了，还要打印，还要出门，出门跑腿，还要花钱，还要拍照上传，真麻烦。最近我也遇到各种这样的事情，于是就想了这么一种办法，用PS做一个实拍图出来。在此分享给大家，看完这篇文章之后，你就可以免去这样的麻烦，简直妙哉妙哉！ 首先上两张图：一张是原来的电子图，一张是经过加工之后签名后的高仿纸张实拍图。亮度可以自行调节。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115212726.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115212726.png" alt="QQ截图20141115212726"></a><a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图201411152127d26.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图201411152127d26.png" alt="QQ截图201411152127d26"></a> 效果还可以吧？现在就教大家一步步地做出这样的效果，流程不难，大家细看。不过前提是你有PS软件. 1.随意给某个文件截个图保存，用ＰＳ打开。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115215800-e1416059977519.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115215800-e1416059977519.jpg" alt="QQ截图20141115215800"></a> 2.在需要签字的地方用画笔工具写上自己的名字，大小1像素，硬度百分百，直接在纸面上写上名字，日期等等。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220111.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220111.jpg" alt="QQ截图20141115220111"></a> 签字完了效果如图所示 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220719.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220719.jpg" alt="QQ截图20141115220719"></a> 3.点击上方菜单中的 图像-&gt;调整-&gt;曝光度，将曝光度调低1个值，这样画面整体就变暗了。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220912.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115220912.jpg" alt="QQ截图20141115220912"></a> 4.点击滤镜-&gt;渲染-&gt;镜头光晕，光晕焦点自己选择，选择105mm变焦，亮度自行调节，我调节为99%，点击确定 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115221338.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115221338.jpg" alt="QQ截图20141115221338"></a> 5.点击滤镜-&gt;扭曲-&gt;水波，数量1，起伏1，用来模拟略微不平的纸张，点击确定 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115221643.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115221643.jpg" alt="QQ截图20141115221643"></a> 6.新建一个图层，注意要新建一个图层！填充为白色，选择 滤镜-&gt;渲染-&gt;分层云彩。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222053.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222053.jpg" alt="QQ截图20141115222053"></a> 按Ctrl+F重复操作几次，在此我们操作了8次，效果如下 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222157.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222157.jpg" alt="QQ截图20141115222157"></a> 7.选择滤镜-&gt;风格化-&gt;浮雕效果，我调整为高度3像素，数量52，这样纸张褶皱效果便出来了，具体可以自行调节。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222259.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222259.jpg" alt="QQ截图20141115222259"></a> 8.选中该图层，在图层上方的样式中选择正片叠底效果。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222500.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222500.jpg" alt="QQ截图20141115222500"></a> <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222646.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222646.jpg" alt="QQ截图20141115222646"></a> 9.调整一下亮度，导出即可。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222804.jpg" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141115222804.jpg" alt="QQ截图20141115222804"></a> 通过以上过程我们就把一张电子图变成了一张实拍纸张图，有没有比较逼真的效果。 大家可以尝试一下，如果有更好的方法，欢迎与我交流。 恩，最后送大家一句话。懒，也是创造的动力。好有哲理的对吧~</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-15 22:33:39" itemprop="dateCreated datePublished" datetime="2014-11-15T22:33:39+08:00">2014-11-15</time>
                </span>
                <span id="/381.html" class="post-meta-item leancloud_visitors" data-flag-title="怎样用PS把电子文档变成实拍纸张图" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>755</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/357.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/357.html" class="post-title-link" itemprop="url">将WordPress部署到七牛云存储实现CDN加速</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>首先我们需要了解什么是 CDN 加速，CDN 加速简单的来说，就是把原服务器上数据复制到其他服务器上，用户访问时，那台服务器近访问到的就是那台服务器上的数据。CDN 加速优点是成本低，速度快。适合访问量比较大的网站。而且，如果你的博客所在的主机是限制流量的，一个很好的办法就是把图片还有其他静态文件部署到其他服务器，这样就会减少主机流量消耗了。 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/20141112194809.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/20141112194809.jpg" alt="20141112194809"></a> 那么我们为什么要用七牛呢？七牛的优势总结如下： 1、安全性能：为用户数据创建至少三个副本并跨IDC存储到多个数据中心，同时支持防盗链设置。</p>
                  <p>2、数据存储：支持图片、音频、视频、JS、CSS等多种静态文件的存储，并支持断点续传。 3、云端加速：七牛的500多个加速节点遍布全球，会自动选择离用户最近的节点，并实现数据上传下载的双向加速。 4、数据处理：支持云端在线压缩、裁剪等图片处理及音频、视频格式转换，还可在线进行视频截图。 5、开发合作：为开发者提供了多种接入工具及丰富的开发包，提供API、SDK教程示例。 6、域名绑定：已备案的网站可申请绑定自己的域名，未备案的用户可使用七牛的二级域名绑定。 7、镜像功能：通过一定的设置，可自动将网站原有图片等静态文件镜像到七牛，而无需重新上传到七牛服务器。 8、外链分享：由于七牛云支持外链，可以将文件上传至七牛，直接利用文件链接地址作外链调用。</p>
                  <p>首先我们需要先有一个七牛云存储的账号 七牛云存储网址：<a href="https://portal.qiniu.com/" target="_blank" rel="noopener">https://portal.qiniu.com/</a> 点击此链接申请一个七牛云存储账号，创建一个公开空间，比如我创建一个空间叫 cuiqingcai，和我的域名相对应。 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112184648-e1415790047735.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112184648-e1415790047735.jpg" alt="QQ截图20141112184648"></a> 创建完成之后它就会为我的这个空间分配一个二级域名。我的就叫 cuiqingcai.qiniudn.com 然后我们需要部署我们的网站，点击右边的空间设置，选择镜像存储里面的一键加速网站，这时就需要你输入镜像源，这里就填写你的博客地址，然后勾选下方的使用默认的 robots.txt 配置文件。 Q：为什么要配置 robot.txt 文件? A：因为你配置了这个网址确定加速之后，七牛会为我们生成一个镜像空间，这个镜像空间的地址就是二级域名地址，我的便是 cuiqingcai.qiniudn.com，你访问之后发现它的内容和我的 cuiqingcai.com 博客网址是完全一致的，这也是为什么把它称为镜像空间的原因。因为内容是一致的，所以会导致搜索引擎对源站 也就是你的域名进行封锁，所以我们可以通过配置 robots.txt 文件避免这种情况的发生。 好，我们继续，点击确定之后我们就能配置好了镜像空间。 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112185908.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112185908.jpg" alt="QQ截图20141112185908"></a> 下面还有一个域名设置，它默认会为你分配一个默认永久的空间，比如我的就是 cuiqingcai.qiniudn.com，这个是七牛的二级域名，七牛的一大特色就是支持域名绑定，在这里你可以添加你的二级域名，不过貌似需要你账户余额大于10块，但是它是不收费的。另外的要求就是你的域名需要备案，如果没有备案，那就不行了。 点击下面的申请域名绑定，然后点击新窗口右下角的自定义域名，会出现以下内容。 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112190327.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112190327.jpg" alt="QQ截图20141112190327"></a> 比如你就可以在此处输入你自己定义的二级域名加备案号。比如我的输入qiniu.cuiqingcai.com 便可以，然后输入备案号，提交审核需要一周之内。你可以先用着它给你分配的二级域名。 好了，配置好了镜像空间和你的域名(或者用默认域名)便可以配置我们的WordPress了。 登陆wordpress仪表盘后，在浏览器中输入：<a href="http://你的域名/wp-admin/options.php，使用Ctrl+F命令找到" target="_blank" rel="noopener">http://你的域名/wp-admin/options.php，使用Ctrl+F命令找到</a> upload_url_path 选项，在其中输入<a href="http://七牛二级域名/wp-content/uploads" target="_blank" rel="noopener">http://七牛二级域名/wp-content/uploads</a> ，注意，后面一定不要加“/”，比如我的便输入 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads。最终格式如下图：" target="_blank" rel="noopener">http://cuiqingcai.qiniudn.com/wp-content/uploads。最终格式如下图：</a> <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/1114.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/1114.jpg" alt="1114"></a> 设置之后，点击最下面的确定，这时你发现你的媒体库中的所有的图片的链接格式都已经更改了，已经不是原来的域名链接了。 而变成了七牛云存储你设置的二级域名的链接。比如我的一张图片链接就变成了 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/545ae06e25ea9.png" target="_blank" rel="noopener">http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/545ae06e25ea9.png</a> 而你点击七牛云存储下的内容管理，就会发现你的博客下的所有图片都已经同步到了里面。截图如下： <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112191445.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112191445.jpg" alt="QQ截图20141112191445"></a> 以后你再新上传的照片也会自动同步到七牛上，此方法的好处在于你只需在wordpress中上传图片，就会自动同步到七牛空间，而无需登陆七牛上传并手动输入图片地址了。并且除了图片地址改变外，其他操作如常。引用图片时会自动加载七牛空间中的图片，实现 wordpress 免费CDN全网加速。不便之处是上传的图片仍会在 wordpress 空间中保留，占用空间容量。也就是说，它仍然在你的本地保存了一份，不过访问时会访问七牛的网址，也就可以实现CDN加速，而且为你的主机节省流量了。当然，由于图片已同步至七牛镜像空间中，你也可以选择删除 wordpress 中的图片。 现在浏览你的网站，如果现在没有问题，那么你就可以不用浏览下面的额外内容，如果有部分图片显示有问题，那么请继续看。 如果你的网站设置了特色图像功能，比较悲剧的事情就发生了。你的网站可能无法读取特色图像，整个页面也显得很难看。这是因为WordPress使用了timthumb缩略图剪裁插件，通过这个插件，用户在后台上传的各种图片都会按照预先在前端页面中设置的大小进行剪裁，大大降低了前端开发的难度。 由于timthumb默认设置中，出于安全考虑是不允许缓存外部地址图片的。因此我们打开timthumb缓存路径时会提示 “您可能无法从该网站获取的图像“。所以解决的办法来了。 找到这个主题所在的目录，找到timthumb.php文件，将下面一条语句</p>
                  <figure class="highlight lasso">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"> <span class="class"><span class="keyword">define</span> </span>(<span class="string">'ALLOW_ALL_EXTERNAL_SITES'</span>, <span class="literal">false</span>)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>替换为</p>
                  <figure class="highlight lasso">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"> <span class="class"><span class="keyword">define</span> </span>(<span class="string">'ALLOW_ALL_EXTERNAL_SITES'</span>, <span class="literal">true</span>)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样就可以实现通过外链抓取图片了，特色图像便显示出来了。 现在再浏览你的网站，看看还有没有什么问题，如果没有问题，现在就美美地享受移植到七牛上带来的便捷和欢乐吧！ 如果还有问题，请继续阅读下方内容。 现在一般的网站模板加载都没有问题了，如果你用的 WordPress 模板比较高级，利用了Ajax异步加载功能，我们便会发现异步加载已经是不会生效的，也可能你的整个网站样式变得混乱。这是为什么？是因为你修改了路径为七牛的路径，加载JS或者CSS文件时便会去七牛那里寻找，但是现在七牛上只同步了图片，JS和CSS文件是不存在的，这时因为找不到这些文件，你的网站便会出现问题了。 现提供两个解决方法： 1.使用水煮鱼的“七牛镜像存储 WordPress 插件”将你的其他文件(如JS,CSS)同步到七牛 插件下载地址：<a href="https://wordpress.org/plugins/wpjam-qiniu/" target="_blank" rel="noopener">https://wordpress.org/plugins/wpjam-qiniu/</a> 配置好这个插件之后，你可以点击 <a href="http://pan.baidu.com/s/10GtRK" target="_blank" rel="noopener">插件使用帮助</a> 来配置这个插件，配置完了之后便可以将你的js和css文件上传到七牛中。你的Ajax异步加载就不会出现问题了。 2.使用WP Super Cache插件进行同步 插件下载地址：<a href="http://wordpress.org/plugins/wp-super-cache/" target="_blank" rel="noopener">http://wordpress.org/plugins/wp-super-cache/</a> 贴心提示：插件安装之后可能出现如下错误 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112193509.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/QQ截图20141112193509.jpg" alt="QQ截图20141112193509"></a> 固定链接出错，这时你更改下左边面板-设置-固定链接，更改为其他选项，不要选择原来的固定链接就好了，比如我选择文章名这个选项，插件就可以顺利进入啦。 在这里点击CDN选项卡，点击开启CDN支持。 <a href="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/112194058.jpg" target="_blank" rel="noopener"><img src="http://cuiqingcai.qiniudn.com/wp-content/uploads/2014/11/112194058.jpg" alt="112194058"></a> 其中Off-site-URL更改为你的七牛镜像域名，比如我的便是 cuiqingcai.qiniudn.com，这样点击确定之后便同样可以把你的JS等文件同步到七牛。你的样式或者Ajax异步加载就可以顺利实现啦。 通过以上步骤，我们就可以将我们的博客部署到七牛云存储上，提高网站加载速度，同时也节省我们的主机流量。一举两得，美哉美哉！ 到此为止，我们的网站应该都没有问题了，尽情享受CDN加速之后带来的效果吧！如果还有问题，请评论或者给我留言。</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-12 19:48:41" itemprop="dateCreated datePublished" datetime="2014-11-12T19:48:41+08:00">2014-11-12</time>
                </span>
                <span id="/357.html" class="post-meta-item leancloud_visitors" data-flag-title="将WordPress部署到七牛云存储实现CDN加速" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>3.3k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>3 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/349.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Linux <i class="label-arrow"></i>
                  </a>
                  <a href="/349.html" class="post-title-link" itemprop="url">在Ubuntu Linux下怎样安装QQ</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <h2 id="友情提示"><a href="#友情提示" class="headerlink" title="友情提示"></a>友情提示</h2>
                  <p>注意，本篇教程由于年代比较久远，QQ可能不再好用，仅供参考。</p>
                  <h2 id="正文"><a href="#正文" class="headerlink" title="正文"></a>正文</h2>
                  <p>最近好多人在吐槽Linux下上QQ简直就是煎熬，网页版的不方便，网上各种版本的QQ要么是功能不全、要么是界面丑到爆，要么是运行不稳定。那么这次为大家带来一个功能完整、运行稳定的wineQQ安装过程。 我的Linux系统是Ubuntu 14.04，64位版本。首先展示一下安装完QQ之后的体验过程吧。先截个图看一下。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110092945.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110092945-300x200.png" alt="QQ截图20141110092945"></a> <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110092651.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110092651-124x300.png" alt="QQ截图20141110092651"></a> <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110093116.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141110093116-300x168.png" alt="QQ截图20141110093116"></a> 功能还是比较齐全的，基本相当于Windows下QQ2013的功能了。QQ对话气泡、传文件、远程协助、群聊、讨论组、视频和语音通话都是有的，体验还是比较好的，光看不行呀，我们就来亲自体验一下怎样在自己的Ubuntu Linux下安装这个QQ吧。 首先我要说的是这个QQ叫wineQQ，什么是wine呢，简单地说它就是在Linux下来运行exe程序的一个工具。我尝试过打开Windows下的QQ音乐等软件，但是体验不算很好，有时无响应。要在wine里运行的话还是要考虑运行专门为wine定制的程序比较好。那么这一款QQ就是专门为wine定制的一款QQ，全名wine QQ TM2013 那么接下来我们首先要做的就是安装wine啦，Ubuntu下的命令一键安装</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="builtin-name">get</span> install wine</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>安装完之后我们就开始下载一个wineQQ2013，网盘下载地址为 <a href="http://pan.baidu.com/s/1i323T4p" target="_blank" rel="noopener">http://pan.baidu.com/s/1i323T4p</a> QQ比较大，有175M，如果大家网速不够给力的话可以先做着其他的事情。 那么下载完成之后呢，我们就需要安装它啦。 找到它的下载路径..一路cd cd cd过去，到它所在的目录。</p>
                  <figure class="highlight reasonml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo dpkg -i WineTM2013-<span class="number">20131206</span>-<span class="module-access"><span class="module"><span class="identifier">Longene</span>.</span></span>deb</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>解释下这个命令的意思，“dpkg ”是“Debian Packager ”的简写。为 “Debian” 专门开发的套件管理系统，方便软件的安装、更新及移除。所有源自“Debian”的“Linux ”发行版都使用 “dpkg”，例如 “Ubuntu”、“Knoppix ”等。dpkg –i 即为手工安装deb包到系统中，那么后面的就是文件名了，后缀是deb格式。</p>
                  <p>如果你的系统是64位的系统，还要运行下面的命令来添加一个支持的库，否则你的QQ还是不能打开。当然如果是32位的系统就不用安装这个了。</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo apt-<span class="keyword">get</span> install libgtk2<span class="number">.0</span><span class="number">-0</span>:i386</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>以上工作完成以后，我们就看一下我们的文件系统有没有什么变化吧，软件安装到哪里了？ 我们会发现在 /opt 文件夹下多了一个longene，里面多了一个tm2013的文件夹，这个就是你的 QQ 所在的文件夹。里面存在一个wine-lib的支持库，就是利用wine来运行这个QQ的。 这时桌面上应该会自动生成了一个tm2013的QQ图标，如果没有的话把文件夹下的QQ拖到桌面或者侧边栏就可以随心所欲地使用QQ啦。 贴心小提示： 1.如果你没法拖动，提示没有权限操作，那么运行如下命令。</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">sudo chmod <span class="number">777</span> -R tm2013</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>chmod是赋值权限的意思，777是添加所有用户控制权限，当然你可以查一下相关资料，为了保证安全，可以将权限数字更改一下也是没有问题的。-R tm2013是递归地将tm2013文件夹的所有文件和文件夹权限全部设为前面的指定的777权限。 2.运行QQ提示密码错误 如果提示密码错误，请使用QQ面板上的虚拟键盘，直接用电脑键盘输入可能识别会不对。这个也是让我折腾了好一阵，甚至都要找回密码了。在此奉献给大家这个经验。 如果还有问题，请留言告诉我，或者发我的邮箱 1016903103@qq.com 希望能给大家带来美好体验！尽情地享受Linux里上QQ的欢乐吧！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-10 10:09:09" itemprop="dateCreated datePublished" datetime="2014-11-10T10:09:09+08:00">2014-11-10</time>
                </span>
                <span id="/349.html" class="post-meta-item leancloud_visitors" data-flag-title="在Ubuntu Linux下怎样安装QQ" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>1.5k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/344.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> HTML <i class="label-arrow"></i>
                  </a>
                  <a href="/344.html" class="post-title-link" itemprop="url">HTML5定稿了，为什么原生App世界将被颠覆</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p><strong>摘要：</strong>2014年10月底，HTML5规范正式定稿，结束了长达8年的长跑。数字天堂董事长，DCloud CEO王安梳理了HTML5诞生至今的演变过程，并从开发者和用户两个角度分析了HTML对两个人群的优势。</p>
                  <p>2007年W3C（万维网联盟）立项HTML5，直至2014年10月底，这个长达八年的规范终于正式封稿。 过去这些年，HTML5颠覆了PC互联网的格局，优化了移动互联网的体验，接下来，HTML5将颠覆原生App世界。这听起来有点危言耸听，但若认真分析HTML5的发展史，你会发现，这个世界的发展趋势确实就是这样。 熟知历史才能预知未来，先让我们来看看HTML5为什么诞生、这8年是怎么过来的。 <a href="http://cms.csdnimg.cn/article/201411/06/545ae06e25ea9.jpg" target="_blank" rel="noopener"><img src="http://cms.csdnimg.cn/article/201411/06/545ae06e25ea9.jpg" alt=""></a> <em>作者简介：王安，数字天堂公司董事长，DCloud CEO。</em></p>
                  <h3 id="HTML5的诞生"><a href="#HTML5的诞生" class="headerlink" title="HTML5的诞生"></a><strong>HTML5的诞生</strong></h3>
                  <p>自W3C于1999年发布HTML4后，Web世界快速发展，一片繁荣。人们一度认为HTML标准不需要升级了。一些致力于发展Web App的公司另行成立了WHATWG组织，直到2007年，W3C从WHATWG接手相关工作，重新开始发展HTML5。 HTML5的发展史，有用户的需求在推动，有技术开发者的需求在推动，更有巨大的商业利益在推动。 在互联网的早期，对用户而言，能打开浏览器接入到互联网世界就是一个神奇的事情，但互联网发展到2005年前后，开始出现下一个变化，就是宽带互联。 随着宽带的普及和电脑性能的增强，人们不再满足于单纯的通过互联网看新闻、收发邮件，消耗更高带宽的娱乐产品开始出现，就是流视频和网页游戏。其实视频和游戏是古老的需求，在互联网不普及的时候，需求的满足方式是离线传输的VCD和游戏光盘；后来互联网逐渐普及，人们更改了使用方式，通过下载软件+本地媒体播放器来看视频，下载体积较大的端游玩游戏。 但是对消费者体验更好的新方式还是出现并颠覆了以前的一切，那就是流媒体和网页游戏。YouTube等公司把握住潮流飞速崛起，各种页游公司也如雨后春笋。 但是HTML标准没有把握住产业的变化及时演进，浏览器产品也未升级，这块新需求被浏览器插件满足了，那就是Flash。这个部署在亿万浏览器里的商业插件俨然成为事实标准。2005年Adobe巨资收购Macromedia，把Flash收归旗下，紧接着大幅推广FLV流媒体和action script语言，很明显这桩收购可以列为IT并购的经典案例，FLV流媒体和Flash游戏风靡互联网，Adobe在新的产业升级中攫取了大量的利润。 除了Flash这个商业产品成为了事实标准，W3C还面临一个尴尬，就是另一个私有扩展协议的制造者—IE。IE当时在桌面浏览器占有垄断地位，并且扩展了大量的IE Only语法，开发者完全不知道这些语言是谁定义的。整个Web世界，就被两家公司微软+Adobe绑架了。 很多IT巨头都坐不住了，尤其是苹果和Google。PC操作系统的世界难有突破，Web浏览器被苹果寄予厚望，而且第一代iPhone只支持网页，那时还没有Appstore，Safari是乔布斯非常看重的产品；新贵Google虽然大量赞助Mozilla，但并未对IE的地位产生实质影响，收购了YouTube后发现底层被Adobe控制，也是非常难过，而且Google每年给IE的搜索框和Adoble FLV缴纳的费用真不是小数目。 既然大家都是W3C的主席单位，好吧，我们重新开始做HTML5吧。 是的，HTML5其实就是这么诞生的。那是2007年，IE和Flash由盛转衰的转折点。</p>
                  <h3 id="HTML5第一阶段：Web增强与破垄断"><a href="#HTML5第一阶段：Web增强与破垄断" class="headerlink" title="HTML5第一阶段：Web增强与破垄断"></a><strong>HTML5第一阶段：Web增强与破垄断</strong></h3>
                  <p>自HTML5诞生以来，一共经历了两个阶段，分别是Web增强和移动互联网。我们先从Web 增强说起。 Web体验的丰富增强主要表现在：1. WebApp，比如Gmail；2. 流媒体；3. 游戏。我们就这3个方面来讲HTML5做了什么。</p>
                  <ol>
                    <li>WebApp：HTML5新增了离线存储、更丰富的表单（比如Input type=date）、JS线程、socket王乐、标准扩展embed、以及很多CSS3新语法…</li>
                    <li>流媒体：HTML5新增了Audio、Video</li>
                    <li>游戏：HTML5新增了Canvas、WebGL</li>
                  </ol>
                  <p>当然还有Google努力在HTML5中推进Header和Section等标签，以利于搜索引擎分析，这些不多述。 HTML5补充流媒体和游戏能力后，加上苹果强势拒绝在iOS上引入Flash，成功的遏制了Flash的发展，然后就该遏制IE私有语法了。 在HTML5标准的升级过程中，苹果和Google同时也看到了浏览器市场重新洗牌的机会，他们一方面参与HTML5的规范，一边在浏览器产品上发力。Apple首先开始大力发展Safari，建立WebKit开源项目，Mac、iOS、Windows多平台齐发力；Google起初是赞助Mozilla开发Firefox，后来自己开发了v8引擎，合并WebKit，于2008年正式推出Chrome。“IE的私有规范+Flash不是标准，我们才是标准”这样的口号在新一代浏览器大战中打响，IE瞬间成为千夫所指的垄断代表，甚至成了阻碍Web发展的罪人（当时IE6已数年未更新，并且丝毫不惧Firefox的发展）。 偏偏微软此时也出了晕招，推出了一系列即不完整支持规范又互相不兼容的IE7、8、9、10，彻底失去了开发者的心。 Adobe的Flash被遏制，与Web霸主的位子擦肩而过；IE的私有标准被遏制，并且造成IE市场份额不停下滑，直到IE最新的移动版本反过来开始支持WebKit私有语法，真是令人唏嘘。不知道HTML6是不是该打倒WebKit垄断了。</p>
                  <h3 id="HTML5第二阶段：移动互联网"><a href="#HTML5第二阶段：移动互联网" class="headerlink" title="HTML5第二阶段：移动互联网"></a><strong>HTML5第二阶段：移动互联网</strong></h3>
                  <p>随着Chrome和Safari的高歌猛进，以及IE+Flash的衰落，HTML5告一段落，进入了下一个时代——移动互联网。HTML5的跨平台优势在移动互联网时代被进一步凸显。HTML5是唯一一个通吃PC、Mac、iPhone、iPad、Android、Windows Phone等主流平台的跨平台语言。Java和Flash都曾梦想这个位置，但梦断于iOS。此时人们纷纷开始研究基于HTML5开发跨平台手机应用。很多人当时认为，原生应用只是过渡，就像当年从C/S结构转变为B/S结构一样。而且学习Objective-C和Java很费劲，我既然会网页开发，为何不试试HTML5。 W3C此时成立了Device API工作组，为HTML5扩展了Camera、GPS等手机特有的API，然而麻烦的是，移动互联网初期的迭代太快了，手机OS在不停的扩展硬件API，陀螺仪、距离感应器、气压计。。。每年手机OS都有大版本更新。而W3C作为一个数百家会员单位共同决策的组织，从标准草案的提出到达成一致是非常复杂的过程，跟不上移动互联网初期的快速迭代。 PhoneGap的出现，给开发者打开了一扇窗。很多人期待PhoneGap不停扩展API，来补充浏览器的不足。Adobe看到PhoneGap仿佛看到了重振江湖地位的希望，但在Adobe收购PhoneGap后，又发现这个东西可商用性不足，而且开源使得Adobe无法像Flash那样获取商业利益，于是就把PhoneGap捐给了Apache，改名为Cordova。 因为各种原因，Cordova的定位最终没有成为浏览器的强化，而走向了混合式开发。基于当时的背景，他们认为原生是不可替代的，“原生+HTML5”的混合模式更有意义。所以现在Cordova的使用模型是“原生工程师+HTML5工程师”一起协作完成App。 这时Facebook加入了W3C，牵头成立了Mobile Web工作组。Facebook是混Web圈的，并且在手机OS上没有自己的领地，他不喜欢被苹果和Google掌控的原生应用生态系统。Mobile Web这个工作组的重要目标就是让HTML5开发的网页应用达到原生应用的体验。然而，事与愿违，它不努力也就算了，结果是努力了却失败了。2012年，Facebook放弃了HTML5的新闻充斥了全世界的IT媒体，HTML5瞬间被打入冷宫。 Facebook为何放弃HTML5？核心是当时基于HTML5真的做不出好的移动App。对比Twritter等竞争对手的原生App，Facebook的HTML5版本实在无法让用户满意。比如Push功能，到现在HTML5的推送和原生的推送体验差距依然巨大，更不用说HTML5应用的页面切换白屏、下拉刷新/侧滑菜单不流畅等众多问题。看着原生工程师轻松实现摇一摇、二维码、语音输入、分享到朋友圈等功能，更是让HTML5工程师感觉自己站错了队。 即使Facebook不喜欢被控制，也不能拿被用户抛弃来冒险。而且Facebook并没有掌握关键点—手机浏览器内核。如果浏览器不跟上，徒然定一堆标准草案落不了地。 而浏览器在手机上的表现是什么呢？先看Google，Chrome性能虽高，但Android上的浏览器却并非Chrome，而是WebKit改出来的一个蹩脚的Android浏览器；再看苹果，iOS上不允许其他浏览器引擎上架App Store，而且其他使用Safari引擎的应用也无法调用苹果自己的JavaScript加速引擎Nitro。结果是苹果和Google不但不在浏览器上积极实现HTML5关于移动App所需的规范，反而对HTML5做出种种限制。 不管是当时硬件能力不足，还是手机OS厂商的故意限制，总之结果就是：在移动互联网的初期，一定是原生应用生态系统的天下，iOS和Android首先自己的地盘稳固后，产业才会向下个阶段升级。 Facebook也好，PhoneGap也好，想在移动互联网初期就分一杯羹是分不到的，但坚持下来，机会往往会出现。</p>
                  <h3 id="HTML5这回真的来了"><a href="#HTML5这回真的来了" class="headerlink" title="HTML5这回真的来了"></a><strong>HTML5这回真的来了</strong></h3>
                  <p>终于，在2014年10月底，W3C宣布HTML5正式定稿。这个时间，不晚不早，硬件性能更强、手机OS迭代速度下降。 随着HTML5标准定稿，一切纷争将告一段落，现在，属于HTML5的时代到来了。 有人说，光标准定稿没用啊，配套起来了吗？HTML5做的应用究竟能否匹敌原生App？答案是，HTML5不但可以匹敌原生App，甚至它天然的很多特性超越了原生App。 我们先谈谈HTML5原来不如原生应用的地方，业内俗称HTML5有“性工能”障碍。即HTML5<strong>性</strong>能不如原生、开发<strong>工</strong>具不如原生、<strong>能</strong>力调用不如原生。 <a href="http://cms.csdnimg.cn/article/201411/06/545ad8faa2704.jpg" target="_blank" rel="noopener"><img src="http://cms.csdnimg.cn/article/201411/06/545ad8faa2704.jpg" alt=""></a> 这几个问题导致开发者无法使用HTML5做出与原生一样的App。然而，不管是硬件升级还是OS厂商策略变化，以及相关软件技术的成熟，已解决了HTML5的“性工能”障碍。 1. 硬件升级 2011年，iPhone 4s的CPU是A5，现在iPhone 6是A8，按苹果的历次发布会的说法，速度共提升了7.5倍。这3年间7.5倍的速度提升，抹平了太多HTML5的性能问题。 2. 苹果、Google的策略变化 Google在2013年底发布的Android 4.4，内置的Webview不再是蹩脚的Android WebKit浏览器，而是Chromium，性能大幅提升。从最新的Android 5.0开始，Webview可以通过Google Play Store实时更新，和Chrome的升级保持一致，用户就可以不刷机享受到最新的浏览器引擎；再看Apple方面，2012年iPhone 5发布后，HTML5在iOS上的表现已令人满意，Safari独家的JavaScript加速引擎Nitro不再那么重要，不过在iOS 8发布后，苹果还是很识趣地取消了三方程序调用Nitro的限制，现在任意浏览器或应用调用iOS的UIWebview都可以利用Nitro加速，这样在前端使用JS做大型运算也成为可能。两大手机操作系统霸主和浏览器巨头的态度发生了变化，使得HTML5在手机上的发展不再受限，而且这个变化不可逆只能继续向前，这种变化势必会产生深远的影响。 3. 软件技术的成熟 PhoneGap的发展虽然放缓了，但其他产品技术却成熟了。2014年的iWeb大会上，众多厂商的产品提供了面向开发者免费或开源的HTML5性工能障碍的解决方案。 <em>（注：作者作为从业人员，也会在分析各种方案时提到我们公司的方案，但作者会客观不夸张的陈述方案，而且该方案是纯免费的，没有商业销售嫌疑。）</em> DCloud公司在iWeb大会上发布了系统的HTML5“性工能缺失”的解决方案，包括： a) 性能：提升HTML5性能的手机端引擎，让侧滑菜单、下拉刷新等动态交互卡顿的问题得以解　决； b) 工具：HTML5开发IDE产品HBuilder, 超快的编程利器； c) 能力：把40万原生API封装成JavaScript对象，以解决HTML5能力不足问题的Native.js技术； d) 最接近原生体验的高性能框架：MUI框架，体积只有几十K，加载、运行远快于一般框架。基于该方案开发的HTML5应用完全可以达到原生App的功能和体验。 <a href="http://cms.csdnimg.cn/article/201411/06/545ad999e6514.jpg" target="_blank" rel="noopener"><img src="http://cms.csdnimg.cn/article/201411/06/545ad999e6514.jpg" alt=""></a> 使用HBuilder开发HTML5应用 英特尔公司发布了Crosswalk引擎，可以让Android 4.0 - 4.3的手机上的应用打包Chromium引擎而不是Android WebKit。毕竟目前市场上存在大量Android 4.0 - 4.3的手机，同时统一的WebView也避免了兼容性的烦恼。 在专业方向上很多公司也做出了不错的成绩。触控的Cocos2d-html5、Egret runtime和Ludei CocoonJS强化了Canvas的表现，让HTML5游戏体验更好；UC、猎豹等手机浏览器都强化了音视频播放的表现。 不管是硬件升级、软件成熟，还是操作系统厂商策略变化，都在强力推动HTML5的爆发。 不过要注意，我说的HTML5爆发，不是指手机浏览器会替代桌面成为应用入口。有人说HTML5不好，因为用户讨厌打开浏览器输入URL的过程。我想说这种想法是对HTML5的片面理解。HTML5!=传统浏览器，虽然编程语言还是HTML、Javascript、CSS，但发行方式绝不是传统网站那么简单。HTML5应用的入口，反而很少是启动浏览器输入URL，它可以是存在于手机桌面的图标、也可以来自超级App（如微信朋友圈）、以及搜索引擎、应用市场、广告联盟。。。到处都是它的入口。它的入口，比原生App更多。</p>
                  <h3 id="原生App的颠覆"><a href="#原生App的颠覆" class="headerlink" title="原生App的颠覆"></a>原生App的颠覆</h3>
                  <p>HTML5的“性工能”障碍得到解决，可以接近原生App的效果，所以它就可以替代原生App吗？很多人认为，即使HTML5会发展的比现在好，也将是与原生App各占一部分市场的格局，要求不高的长尾应用会使用HTML5，而主流应用仍是原生App的天下。 但我认为这样的想法很危险，就像Apple成立前，HP的高层告诉沃兹：谁会在家里摆一台电脑呢？未来HTML5肯定会颠覆原生App。“性工能”障碍的消除，只是HTML5的劣势被削弱，但劣势被消除后，它的优势就会大放异彩，HTML5的优势是什么？我们分别就开发者和最终用户来看。 <strong>HTML5对开发者的7大优势</strong></p>
                  <ul>
                    <li>跨平台：在多屏年代，开发者的痛苦指数非常高，人人都期盼HTML5能扮演救星。多套代码、不同技术工种、业务逻辑同步，这是折磨人的过程。有点类似个人电脑早期世界，那个时候的每家电脑都有自己的操作系统和编程语言，开发者疲于做不同版本，其实DOS的盛行也很大程度是因为开发者实在没精力给其他电脑写程序。跨平台技术在早期大多因为性能问题夭折，但中后期硬件能力增强后又会占据主流，因为跨平台确实是刚需。</li>
                    <li>快速迭代：移动互联网是一个快鱼吃慢鱼的时代，谁对用户的需求满足的更快，谁的试错成本更低，谁就拥有巨大的优势。互联网产品大多免费、且有网络效应，后入者抢夺用户的难度非常大。使用原生开发，从招聘、开发、上线各个环节的效率都慢一倍以上，而且参与的人越多，沟通效率往往拖慢不止一倍。</li>
                    <li>持续交付：很多人有这样的体会，一个原生应用上线App Store，突然有一个大bug，只好连夜加班修复，然后静静等待2周或更长时间的Apple审核，这2个星期被用户的涂抹淹死，市场上一片差评，用户大量流失。等新应用被审核上线了，用户已经卸载了。但是，HTML5没有这些问题，你可以实时更新，有问题立即响应。</li>
                    <li>大幅下降成本：创业者融资并不容易，如何花钱更高效非常重要。如果你使用原生开发的App和竞争对手使用HTML5开发的App没什么区别，但你的开发成本高出一倍，我相信没有投资人会喜欢给你投钱。</li>
                    <li>开源生态系统发达：HTML5前端是开放的正反馈循环生态系统，大量的开源库可以使用，开发应用变得更轻松、更敏捷，当然这也体现在了快速迭代和成本下降上。不过更重要的是，这种开放的正反馈循环生态系统未来的生命力是比原生生态系统更强劲的。</li>
                    <li>开放的数据交换：HTML是以page为单元开放代码的，它无需专门开发SDK，只要不混淆，就能与其他应用交互数据。开发者可以让手机搜索引擎很容易检索到自己的数据， 也更容易通过跨应用协作来满足最终用户需求。</li>
                    <li>导流入口多：HTML5应用导流非常容易，超级App（如微信朋友圈）、搜索引擎、应用市场、浏览器，到处都是HTML5的流量入口。而原生App的流量入口只有应用市场。聪明的HTML5开发者当然会玩转各种流量入口从而取得更强的优势。</li>
                    <li>流量大：前段时间微信朋友圈风靡一时《神经猫》，这个游戏如果放到Appstore，绝对没有那么多流量，超级App带来的流量，远大于原生应用市场。假如微信允许游戏在桌面创建快捷方式、假如游戏后续升级解决持续娱乐问题，未来不可想象。</li>
                    <li>导流效率高：除了入口多、流量大，导流效率高也不可忽视，谁都知道，页游和端游打同样的广告，广告变用户的转化率，页游远远高于端游。可精准导流到二级页：我们都知道搜索引擎可以直接进入到。</li>
                  </ul>
                  <p><strong>HTML5对最终用户的3大优势</strong> 1. 大幅降低使用门槛 为什么流媒体会替代下载视频成为主流？为什么页游会如此火爆？只因用户太“懒”。让用户更方便的满足需求，有时效果好于更多的满足需求。 用户眼睛看到一个兴趣点，点击后，就应该立即开始满足用户需求。比如流媒体可以立即看，页游可以立即玩。而目前的原生应用市场，用户需要这样操作：选一个应用、等待下载、确认权限、等待安装，然后点击打开。这样糟糕的体验迟早要被颠覆。 不管是App、游戏还是音视频，未来都将即点即用。谁先满足用户这个需求，谁就制胜。 2. 实时更新、差量更新的优秀体验 HTML5应用可以绕开应用市场的限制进行自主实时更新，用户可以快速享受新服务。 而且这种更新完全可以是差量更新，比如某个HTML页面或某个js文件有问题，只更新这个几K的小文件就可以了，这比原生应用的更新体验好太多。 3. 跨应用的使用体验 目前手机应用切换是以桌面或任务管理器为中心的，但事实上这些中心很影响效率和体验。用户想出差三亚，先打开去哪App订票，然后切回桌面，再找到并打开天气App，搜索输入三亚，再切到桌面，找到并打开航旅纵横App，输入航班号值机，哦对了，航班号多少来着，再切到桌面，找到并打开去哪App看航班号，最后找到并打开租车App，输入租车地点，然后再切回桌面。。。 在原生应用体系下，用户只能这样。但在HTML5体系下，他不需要切回桌面，他可以在App间方便的直接跳来跳去，而不是使用一个一个孤岛App；他更不用重复录入数据，应用间可以方便的互相传递数据。 这种模式需要一点想象力，但未来迟早会来。 分析至此，我们可以明显的看出，不管是站在最终用户角度、还是站在开发者角度，HTML5必将取代原生应用当前的位置。并由此引发一系列颠覆。</p>
                  <h3 id="还有什么会被改变？"><a href="#还有什么会被改变？" class="headerlink" title="还有什么会被改变？"></a><strong>还有什么会被改变？</strong></h3>
                  <p>HTML5的爆发，原生App生态系统的颠覆，是一场产业革命，很多角色都会受到影响，我们来预测一番。 <strong>新型HTML5引擎战火将烧起</strong> 标准的HTML5引擎并不能解决HTML5的所有问题，拥有大流量入口的互联网巨头，莫不在思考内嵌更优秀的增强引擎。腾讯推出了X5浏览器引擎，就是看中这个机会。目前各路浏览器厂商、应用市场厂商、甚至rom厂商，都在努力整合更优质的浏览器引擎。假使微信内嵌的WebView可以运行更优秀的Canvas游戏、假使360手机助手可以发行即点即用的HTML5应用并且能力体验与原生一致、假使小米rom内置更强大的WebView使得所有HTML5应用在小米手机上运行的更流畅。。。 一个巨头开始行动，所有巨头都会闻风而动，没错，这场战役会是移动互联网世界的二次世界大战。 <strong>应用发行市场将洗牌</strong> 由于超级App的巨大流量能轻易成为HTML5应用的入口，并且会形成大者更大的效应，传统的应用商店、甚至线下预装，这些流量不足和效率偏低的发行模式将被挤出市场主流。本身也是超级App的大流量应用商店，如果转型得当，也将以发行HTML5应用为主。 <strong>广告和统计市场</strong> 原生的广告和统计SDK提供商会面临尬尴，Google、百度等基于网页的广告和统计服务会取得更大的优势。开发者不再需要打包SDK，引入一个Script即可。 <strong>开源技术将在移动互联网领域更加流行</strong> HTML的开放性造就了大量的开源产品，也反向促进了HTML的繁荣。在Github上有大量的JS框架，而原生的开源代码数量相比甚少。而未来移动互联网世界将因为开源而发展的更迅速，这里也同样存在类Github厂商的机遇。 <strong>开发工具的变化</strong> 早期HTML只需要记事本写几个Tag，中期的HTML、JS、CSS比较复杂，需要更高级的文本编辑器，但HTML5到来后，它的代码量、复杂度、开发模型将与原生开发看齐，需要类似Xcode、Eclipse等专业的IDE工具来解决开发、调试的问题。一些以会使用记事本写代码为荣的开发者，将面临思路转换甚至被更高效的开发者淘汰。 <strong>性能分析调优</strong> 目前很多针对原生应用的性能分析调优工具或服务，未来也面临转型，HTML5应用的性能分析调优是另一个世界。 <strong>混淆与产权保护</strong> HTML5是开放代码的，好处也带来弊端，有些东西开发者希望暴露，但有些东西开发者希望保护。混淆技术就变得更有商业机会。PC Web上Gmail的混淆就做的不错。除了JS混淆，离线数据加密相信也有不少空间。 <strong>安全厂商的新机会</strong> HTML5的强大会引发很多安全问题，并且解决思路与原生不一样，业内有可能会出现新的安全厂商领导者。</p>
                  <h3 id="结语"><a href="#结语" class="headerlink" title="结语"></a>结语</h3>
                  <p>写到结尾，感觉话题有点大了。其实未来如何发展是没人能准确预测的，变量非常多。但我想让用户和开发者都更方便的趋势是不会错的。 我在这里抛砖引玉，欢迎大家一起讨论，但我希望我们能理智的分析，在争议中提炼真知，而不是未经思考或验证仅因为害怕被颠覆而无谓的乱喷。(<a href="http://weibo.com/wangan2000" target="_blank" rel="noopener">作者微博</a>） 也祝愿大家在HTML5的浪潮中，把握住机遇，享受下坐在风口当猪的感觉。 文章来源：CSDN <a href="文章来源：CSDN%20http://www.csdn.net/article/2014-11-06/2822513-how-html5-changes/1">文章地址</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-07 11:00:59" itemprop="dateCreated datePublished" datetime="2014-11-07T11:00:59+08:00">2014-11-07</time>
                </span>
                <span id="/344.html" class="post-meta-item leancloud_visitors" data-flag-title="HTML5定稿了，为什么原生App世界将被颠覆" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>9.1k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>8 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/342.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/342.html" class="post-title-link" itemprop="url">重装系统之后一些重要环境变量的配置</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>1.Mingw</p>
                  <p>（1）编辑PATH变量，在最后面加入 D:\mingw\bin D:\mingw\msys\1.0\bin D:\mingw\mingw32\bin （2）添加LIBRARY_PATH变量，内容为： D:\mingw\lib （3）添加C_INCLUDE_PATH变量，内容为： D:\mingw\include （4）添加CPLUS_INCLUDE_PATH变量，内容为： D:\mingw\lib\gcc\mingw32\4.8.1\include\c++ 2.Java (1)JAVA_HOME D:\java Jdk 1.6(2)Path %JAVA_HOME%\bin; %JAVA_HOME%\jre\bin (3)CLASSPATH %JAVA_HOME%\lib 验证：java -version 3.Node.js (1)Path D:\Node.js (2)NODE_PATH D:\Node.js\node_modules 验证: node server.js 4.Android SDK (1)ANDROID_SDK_ROOT D:\AndroidSdk (2)Path %ANDROID_SDK_ROOT%\tools; 验证：android sdk(打开sdk manager) %ANDROID_SDK_ROOT%\platform-tools; 验证：adb devices 5.Android NDK (1)NDK_ROOT D:\AndroidNdk\android-ndk-r9d (2)Path %NDK_ROOT%\ 验证：ndk-build -version 6.Android ANT (1)ANT_ROOT D:\AndroidAnt\apache-ant-1.9.4\bin (2)Path %ANT_ROOT%\ 验证：ant -version 7.Python (1)Path D:\python2.7.7 验证：python —version 8.Cocos2d-x (1)Path D:\cocos2d-x\cocos2d-x-3.0rc2 D:\cocos2d-x\cocos2d-x-3.0rc2\tools\cocos2d-console\bin 验证：cocos compile -p android</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-07 00:45:48" itemprop="dateCreated datePublished" datetime="2014-11-07T00:45:48+08:00">2014-11-07</time>
                </span>
                <span id="/342.html" class="post-meta-item leancloud_visitors" data-flag-title="重装系统之后一些重要环境变量的配置" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>921</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/328.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/328.html" class="post-title-link" itemprop="url">Bootstrap值得关注的知识点总结</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>1. 字体比例大小</p>
                  <figure class="highlight css">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="selector-tag">h1</span> <span class="selector-tag">small</span> &#123;</span><br><span class="line">  <span class="attribute">font-size</span>: <span class="number">65%</span>;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>font-size:65%的意思是h3标签里面的small标签是外面一层字体的65%大小。 比如：</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">h1</span>&gt;</span>Bootstrap标题一<span class="tag">&lt;<span class="name">small</span>&gt;</span>我是副标题<span class="tag">&lt;/<span class="name">small</span>&gt;</span><span class="tag">&lt;/<span class="name">h1</span>&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <h2 id="Bootstrap标题一我是副标题"><a href="#Bootstrap标题一我是副标题" class="headerlink" title="Bootstrap标题一我是副标题"></a>Bootstrap标题一我是副标题</h2>
                  <p>显示效果便是如上，small标签包含的文字外侧h1文字大小的65% 2. 斜体的设置 CSS方法：</p>
                  <figure class="highlight asciidoc">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">*<span class="strong">*font-style*</span><span class="strong">*:*</span><span class="strong">*italic*</span><span class="strong">*</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>标签方法：</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">em</span>&gt;</span>我是斜体<span class="tag">&lt;/<span class="name">em</span>&gt;</span><span class="tag">&lt;<span class="name">i</span>&gt;</span>我也是斜体<span class="tag">&lt;/<span class="name">i</span>&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>3.强调相关的类</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">.<span class="built_in">text</span>-muted：提示，使用浅灰色（<span class="comment">#999）</span></span><br><span class="line">.<span class="built_in">text</span>-primary：主要，使用蓝色（<span class="comment">#428bca）</span></span><br><span class="line">.<span class="built_in">text</span>-success：成功，使用浅绿色(<span class="comment">#3c763d)</span></span><br><span class="line">.<span class="built_in">text</span>-info：通知信息，使用浅蓝色（<span class="comment">#31708f）</span></span><br><span class="line">.<span class="built_in">text</span>-warning：警告，使用黄色（<span class="comment">#8a6d3b）</span></span><br><span class="line">.<span class="built_in">text</span>-danger：危险，使用褐色（<span class="comment">##a94442）</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>4.对齐相关的类</p>
                  <figure class="highlight css">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="selector-class">.text-left</span> &#123;</span><br><span class="line"><span class="attribute">text-align</span>: left;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.text-right</span> &#123;</span><br><span class="line"><span class="attribute">text-align</span>: right;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.text-center</span> &#123;</span><br><span class="line"><span class="attribute">text-align</span>: center;</span><br><span class="line">&#125;</span><br><span class="line"><span class="selector-class">.text-justify</span> &#123;</span><br><span class="line"><span class="attribute">text-align</span>: justify;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>5.列表 无标号列表</p>
                  <figure class="highlight cs">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;ul <span class="keyword">class</span> = <span class="string">"list-unstyled"</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>无标号横向列表</p>
                  <figure class="highlight cs">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;ul <span class="keyword">class</span>=<span class="string">"list-inline"</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>6.代码段 单行内联代码</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;<span class="meta">code</span>&gt;单行内联代码&lt;/<span class="meta">code</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>多行代码</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">pre</span>&gt;</span>多行代码<span class="tag">&lt;/<span class="name">pre</span>&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>用户输入代码</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">kbd</span>&gt;</span>用户输入代码<span class="tag">&lt;/<span class="name">kbd</span>&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>硬编码</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">左尖括号<span class="symbol">&amp;lt;</span> 右尖括号<span class="symbol">&amp;gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>滚动代码</p>
                  <figure class="highlight cs">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">class</span> = <span class="string">"**.pre-scrollable**"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>7.表格</p>
                  <figure class="highlight gams">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">.<span class="keyword">table</span>：基础表格</span><br><span class="line">.<span class="keyword">table</span>-striped：斑马线表格</span><br><span class="line">.<span class="keyword">table</span>-bordered：带边框的表格</span><br><span class="line">.<span class="keyword">table</span>-hover：鼠标悬停高亮的表格</span><br><span class="line">.<span class="keyword">table</span>-condensed：紧凑型表格</span><br><span class="line">.<span class="keyword">table</span>-responsive：响应式表格</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>8.常用表单样式 纵向表单</p>
                  <figure class="highlight stata">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;<span class="keyword">form</span> role=<span class="string">"form"</span>&gt;</span><br><span class="line"> &lt;div <span class="keyword">class</span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">label</span> <span class="keyword">for</span>=<span class="string">"exampleInputEmail1"</span>&gt;邮箱：&lt;/<span class="keyword">label</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">input</span> <span class="keyword">type</span>=<span class="string">"email"</span> <span class="keyword">class</span>=<span class="string">"form-control"</span> id=<span class="string">"exampleInputEmail1"</span> placeholder=<span class="string">"请输入您的邮箱地址"</span>&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;div <span class="keyword">class</span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">label</span> <span class="keyword">for</span>=<span class="string">"exampleInputPassword1"</span>&gt;密码&lt;/<span class="keyword">label</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">input</span> <span class="keyword">type</span>=<span class="string">"password"</span> <span class="keyword">class</span>=<span class="string">"form-control"</span> id=<span class="string">"exampleInputPassword1"</span> placeholder=<span class="string">"请输入您的邮箱密码"</span>&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;div <span class="keyword">class</span>=<span class="string">"checkbox"</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">label</span>&gt;</span><br><span class="line"> &lt;<span class="keyword">input</span> <span class="keyword">type</span>=<span class="string">"checkbox"</span>&gt; 记住密码</span><br><span class="line"> &lt;/<span class="keyword">label</span>&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;button <span class="keyword">type</span>=<span class="string">"submit"</span> <span class="keyword">class</span>=<span class="string">"btn btn-default"</span>&gt;进入邮箱&lt;/button&gt;</span><br><span class="line">&lt;/<span class="keyword">form</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>水平表单</p>
                  <figure class="highlight scala">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;form <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-horizontal"</span> role=<span class="string">"form"</span>&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;label <span class="keyword">for</span>=<span class="string">"inputEmail3"</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-2 control-label"</span>&gt;邮箱&lt;/label&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-10"</span>&gt;</span><br><span class="line"> &lt;input <span class="class"><span class="keyword">type</span></span>=<span class="string">"email"</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-control"</span> id=<span class="string">"inputEmail3"</span> placeholder=<span class="string">"请输入您的邮箱地址"</span>&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;label <span class="keyword">for</span>=<span class="string">"inputPassword3"</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-2 control-label"</span>&gt;密码&lt;/label&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-10"</span>&gt;</span><br><span class="line"> &lt;input <span class="class"><span class="keyword">type</span></span>=<span class="string">"password"</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-control"</span> id=<span class="string">"inputPassword3"</span> placeholder=<span class="string">"请输入您的邮箱密码"</span>&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-offset-2 col-sm-10"</span>&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"checkbox"</span>&gt;</span><br><span class="line"> &lt;label&gt;</span><br><span class="line"> &lt;input <span class="class"><span class="keyword">type</span></span>=<span class="string">"checkbox"</span>&gt; 记住密码</span><br><span class="line"> &lt;/label&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"form-group"</span>&gt;</span><br><span class="line"> &lt;div <span class="class"><span class="keyword">class</span></span>=<span class="string">"col-sm-offset-2 col-sm-10"</span>&gt;</span><br><span class="line"> &lt;button <span class="class"><span class="keyword">type</span></span>=<span class="string">"submit"</span> <span class="class"><span class="keyword">class</span></span>=<span class="string">"btn btn-default"</span>&gt;进入邮箱&lt;/button&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line"> &lt;/div&gt;</span><br><span class="line">&lt;/form&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>下拉条和文本域</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">form</span> <span class="attr">role</span>=<span class="string">"form"</span>&gt;</span></span><br><span class="line"> <span class="comment">&lt;!--下拉条--&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"form-group"</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">select</span> <span class="attr">class</span>=<span class="string">"form-control"</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;<span class="name">option</span>&gt;</span>1<span class="tag">&lt;/<span class="name">option</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;<span class="name">option</span>&gt;</span>2<span class="tag">&lt;/<span class="name">option</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;<span class="name">option</span>&gt;</span>3<span class="tag">&lt;/<span class="name">option</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;<span class="name">option</span>&gt;</span>4<span class="tag">&lt;/<span class="name">option</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;<span class="name">option</span>&gt;</span>5<span class="tag">&lt;/<span class="name">option</span>&gt;</span> </span><br><span class="line"> <span class="tag">&lt;/<span class="name">select</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">div</span> <span class="attr">class</span>=<span class="string">"form-group"</span>&gt;</span></span><br><span class="line"> <span class="comment">&lt;!--文本域--&gt;</span></span><br><span class="line"> <span class="tag">&lt;<span class="name">textarea</span> <span class="attr">class</span>=<span class="string">"form-control"</span> <span class="attr">rows</span>=<span class="string">"3"</span>&gt;</span><span class="tag">&lt;/<span class="name">textarea</span>&gt;</span></span><br><span class="line"> <span class="tag">&lt;/<span class="name">div</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>单选框和复选框</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;form role=<span class="string">"form"</span>&gt;</span><br><span class="line"> &lt;h3&gt;案例<span class="number">1</span>&lt;/h3&gt;</span><br><span class="line"> &lt;div <span class="keyword">class</span>="<span class="symbol">checkbox</span>"&gt;</span><br><span class="line"> &lt;<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;<span class="symbol">input</span> <span class="symbol">type</span>="<span class="symbol">checkbox</span>" <span class="symbol">value</span>=""&gt;</span><br><span class="line"> 记住密码</span><br><span class="line"> &lt;/<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;/<span class="symbol">div</span>&gt;</span><br><span class="line"> &lt;<span class="symbol">div</span> <span class="symbol">class</span>="<span class="symbol">radio</span>"&gt;</span><br><span class="line"> &lt;<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;<span class="symbol">input</span> <span class="symbol">type</span>="<span class="symbol">radio</span>" <span class="symbol">name</span>="<span class="symbol">optionsRadios</span>" <span class="symbol">id</span>="<span class="symbol">optionsRadios1</span>" <span class="symbol">value</span>="<span class="symbol">love</span>" <span class="symbol">checked</span>&gt;</span><br><span class="line"> 喜欢</span><br><span class="line"> &lt;/<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;/<span class="symbol">div</span>&gt;</span><br><span class="line"> &lt;<span class="symbol">div</span> <span class="symbol">class</span>="<span class="symbol">radio</span>"&gt;</span><br><span class="line"> &lt;<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;<span class="symbol">input</span> <span class="symbol">type</span>="<span class="symbol">radio</span>" <span class="symbol">name</span>="<span class="symbol">optionsRadios</span>" <span class="symbol">id</span>="<span class="symbol">optionsRadios2</span>" <span class="symbol">value</span>="<span class="symbol">hate</span>"&gt;</span><br><span class="line"> 不喜欢</span><br><span class="line"> &lt;/<span class="symbol">label</span>&gt;</span><br><span class="line"> &lt;/<span class="symbol">div</span>&gt;</span><br><span class="line">&lt;/<span class="symbol">form</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>9.一些比较好看的按钮 <a href="http://cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141104191608.jpg"><img src="http://cuiqingcai.com/wp-content/uploads/2014/11/QQ截图20141104191608-159x300.jpg" alt="QQ截图20141104191608"></a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-04 19:46:34" itemprop="dateCreated datePublished" datetime="2014-11-04T19:46:34+08:00">2014-11-04</time>
                </span>
                <span id="/328.html" class="post-meta-item leancloud_visitors" data-flag-title="Bootstrap值得关注的知识点总结" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>3.6k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>3 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/319.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> 个人随笔 <i class="label-arrow"></i>
                  </a>
                  <a href="/319.html" class="post-title-link" itemprop="url">从西少爷肉夹馍谈起创业</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>暑假时去了一趟北京拜访我叔叔，他是一位IT人士，正走在创业的道路上。他跟我说：“其实创业很简单，你看五道口那边的有个西少爷肉夹馍，是由几个西安交大毕业的大学生创办的，现在已经日入万元啦！”听完之后我觉得很震惊，餐饮业里只靠卖肉夹馍能日入万元？里面到底有什么奥秘，当时真想去看看它那肉夹馍有什么特别的。晚上回去休息的时候正好路过西少爷肉夹馍那边，不过令我惊奇的是都那么晚了竟然还排了那么长的队伍。叔叔说：“这里呀，从早上还没营业就已经排了几十米啦，从早到晚都是这样。”听完真是让我为之一振，不过当时由于赶时间要回去，所以不得不放弃这个亲密接触肉夹馍的机会了，有点遗憾。 <img src="http://i8.hexunimg.cn/2014-08-07/167322712.jpg" alt=""> 回去之后，我一直对这件事念念不忘，西少爷肉夹馍能这么成功？我得去一探究竟。上网扒了一些相关的资料，算是对它有了一定的了解吧。趁这个机会，我把它记录下来。西少爷的创始人叫孟兵，和他一起创业的伙伴们都是来自腾讯、阿里、百度等知名公司的，也是一些IT界人士了，大家可能会纳闷，他们都进了这么大的公司了为什么还辞职卖肉夹馍呢？只能说他们有自己的想法和追求，具体原因，我也不详谈了。话说回来，他们为什么把自己的生意做得这么火爆？可以概括地这么说吧，他们利用了互联网的思维来经营自己的肉夹馍产品。 肉夹馍作为一个传统得不能再传统的餐饮行业，西少爷在它中间注入了互联网思维模式，一切都变得让人不可想象。可以说西少爷不仅仅是在做一个肉夹馍，他们在做一个产品，一个项目，而他们的公司则可以定位成一家互联网公司而不单单是一家餐饮公司。之前有一篇宣传故事叫《我为什么要辞职去卖肉夹馍》，里面写道创始人孟兵一开始就想去做肉夹馍，但其实不是这样。孟兵在北上广深四个一线城市都呆过一段时间，他通过对路边的小吃摊观察后发现，像驴肉火烧这种有地方特色的小吃是比较难流通到其他城市的，而像米粉啊、鸡蛋饼啊等等这种普遍性的产品才适合去经营。不过，要经营必须要结合自身的优势做出一款更好的有特色的产品来，在同行业的竞争中才能显出自己的优势。最后，孟兵通过与家乡陕西的特色小吃相对比，找出了一个最适合的产品，那就是肉夹馍。为什么？肉夹馍也作为陕西的特色小吃，同时也是全国的一项普遍性的产品，另外选择肉夹馍不仅仅是他对自己家乡的热爱，更重要愿望是想把具有陕西特色的肉夹馍带给大众的愿望。可以说，这些观察，这些思考，这些抉择，首先找准了产品路线的定位目标。 那么大多数人如果是确定了方向之后，就直接开始干了吧。孟兵呢？他没有这么做。目标找到了，但是设计理念上怎样呢？毕竟从陕西学到的肉夹馍的制作方法只是能让陕西人喜欢而已，但是能够做到所有人都喜欢吗？在产品研发上，这也是PM(产品经理)所需要考虑的问题。产品当然要做到让大多数人满意，只有一小部分人说好那不叫好，百分之八九十的人说好那才是真正的好。所以，半年的时间，孟兵和其他创始人没有做别的，他们把精力放在了产品(肉夹馍)的内测上，同时生产流程等等要做相应的优化，怎样保持松脆，怎样保持好的口感，都是他们需要考虑的问题。有两个创始人在百度呆过，他们知道搜索引擎这个东西是需要一定的计算公式的，而算法工程师也是要不断调整这个公式的变量来做到网站排名的优化，巧妙的是，他们把这套理念应用到了肉夹馍上，这也是一个学习和应用的过程。他们为肉夹馍放盐的多少、切肉的厚度、肉夹馍的厚度、肉夹馍的直径等等建立了一套计算公式，通过微调来调整口感，并且通过用户的反馈信息来不断进行优化。这种设计理念，这种设计思路，如果你没有相关的经验，如果你没有创新的思维，可以想到吗？孟兵说：”一个肉夹馍的研发绝对不亚于一个搜索引擎。而这种利用公式来制作肉夹馍的做法，一方面是我们的心血创造，但另一方面也很感谢百度这样的大公司为我们带来的视野与格局，也才能如此跨界。”那么他们是怎么测试的呢？可以归结如下：</p>
                  <p> 内测Beta1.0，测试人员为10人左右，不断烘烤反复品尝味道，然后不断更换人员组成（亲戚朋友），反复测试该口感。内测Beta2.0，测试人员为20人左右，不断扩大测试人员的范围。内测Beta3.0，测试人员为30人左右，开始在北京街边学校等随机拉人来品尝。内测Beta4.0，这是测试的最后一版，团队举行了最后一次测试，地点定在清华，测试人员为100人，最后确定这100人中绝大多数人对口感是否非常满意。</p>
                  <p> 正式公测1.0，五道口开张，火爆全场！</p>
                  <p> 西少爷团队除了做到这一天，在每天平均工作近20个小时的情况下，每天准时9点开会，继续商量着怎样对自己的项目进行更好的优化，在工作流程上，切肉环节上，收款环节上能不能有进一步的提升。我想，这也是产品研发过程必不可少的一部分。</p>
                  <p> 说到情怀，大家可能想起老罗和锤子，其实不单是老罗，他们也在追求一种极致情怀，比如小摊上肉夹馍小贩给你的肉夹馍都是用塑料袋盛放的吧，他们可不这样想，他们认为这样降低了用户体验，他们采用的纸袋包装方式，并且非但用普通的纸，他们还在追求一种不能透油的纸，提高他们的用户体验指数，不仅要保证食品的安全，还要达到最优化的效果。设想一下，光包装就追求这样，他们的肉夹馍能达到什么程度？另外北京的物价比较高是众所周知的，不过他们的肉夹馍定价竟然比陕西本地的肉夹馍还便宜，在五道口这个繁华的地段，他们仍坚持7元一份，希望能有更多人来体验到他们的产品。为了做这些肉夹馍，他们几个还特意回到西安拜师学艺，从零开始学习做最正宗的肉夹馍，用掉5000斤面粉和2000斤肉，他们终于研制出西少爷的特有秘方，为了这个产品，他们也是不惜一切，追求极致。毕竟是IT人，他们更懂得IT人的不易，促销时，他们会写凡是持有百度、阿里、腾讯等等公司工卡的顾客，均可享受一份肉夹馍面单，这份贴心，体现的也是一种情怀。</p>
                  <pre><code>没有深入了解他们时我们可能产生这么一种想法，他们运用的是一种善于操纵营销的互联网思维，但是通过我的深入了解，他们的理念令我敬畏。孟兵的思想是，产品永远放在第一，营销放第二。真正好的产品具有自己的传播能力，口碑好，产品流传得广，自然不会轻易死掉。前几天听了一个讲座，你想做一个推广，原始的B2C模式是难以取得好的效果的，可以说纯粹操纵营销的手段是行不通的。只有产品真正达到一定层次，具有自传播能力，达到C2C亦或是P2P模式，那才说明你真正的成功了。好的产品，用户用着好，自然会去分享传播，真正好的产品不需要你具有多么好的营销手段才能做推广。他们把更多的时间放在产品上，一心一意做自己的产品，用户自然会像龙卷风一样慢慢被卷进来。

当然，并不是说不重视营销手段，只是它的地位比产品低了一层，有了很好的产品，没有合适的营销手段自然也是不行。这里就会牵扯到40人智囊团了。他们在公司里积累了一些人脉资源，有来自大大小小的公司阶层也在为他们的营销出谋划策，他们营销策略的背后不仅是团队的讨论决策，更有各路有经验的人在背后起着导航作用。所以说，营销在他看来虽然比不上产品重要，但是是向各路取经得来的宝贵经验也是他们经营成功的法宝之一。
</code></pre>
                  <p> 通过了解他们的经营模式和理念，我真的感触颇深。我相信，越来越多的人会利用这种互联网思维来为他们的创业注入新的血液，将传统的行业升级，打造一个不一样的世界。也或许，我会成为其中之一，但那一切，现在都是未知。</p>
                  <p>(文/崔庆才)</p>
                  <p>2014.11.3</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-04 00:02:51" itemprop="dateCreated datePublished" datetime="2014-11-04T00:02:51+08:00">2014-11-04</time>
                </span>
                <span id="/319.html" class="post-meta-item leancloud_visitors" data-flag-title="从西少爷肉夹馍谈起创业" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>3k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>3 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/297.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/297.html" class="post-title-link" itemprop="url">Git常用命令总结</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>1.初始化本地仓库</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git init</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>2.添加文件到本地仓库暂存区</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">add</span><span class="bash"> a.txt</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>3.添加文件到本地仓库</p>
                  <figure class="highlight nginx">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git</span> commit -m <span class="string">'v1'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>此命令代表确认提交到本地仓库。-m ‘v1’代表为此添加一个版本标记v1 4.查看当前git的状态</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git status</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果A：</p>
                  <figure class="highlight sql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">On branch master</span><br><span class="line">Changes not staged for <span class="keyword">commit</span>:</span><br><span class="line">(<span class="keyword">use</span> <span class="string">"git add &lt;file&gt;..."</span> <span class="keyword">to</span> <span class="keyword">update</span> what will be committed)</span><br><span class="line">(<span class="keyword">use</span> <span class="string">"git checkout -- &lt;file&gt;..."</span> <span class="keyword">to</span> discard changes <span class="keyword">in</span> working <span class="keyword">directory</span>)</span><br><span class="line"></span><br><span class="line">modified: readme.txt</span><br><span class="line"></span><br><span class="line"><span class="keyword">no</span> changes added <span class="keyword">to</span> <span class="keyword">commit</span> (<span class="keyword">use</span> <span class="string">"git add"</span> <span class="keyword">and</span>/<span class="keyword">or</span> <span class="string">"git commit -a"</span>)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>证明当前有文件已经修改，但是没有准备提交的修改，没有add和commit 结果B：</p>
                  <figure class="highlight vhdl">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"> <span class="keyword">On</span> branch master</span><br><span class="line">Changes <span class="keyword">to</span> be committed:</span><br><span class="line">(<span class="keyword">use</span> <span class="string">"git reset HEAD &lt;file&gt;..."</span> <span class="keyword">to</span> unstage)</span><br><span class="line"></span><br><span class="line">modified: readme.txt</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>证明当前已经有文件提交了，但是还没有commit 结果C：</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">On</span> branch master</span><br><span class="line"><span class="keyword">nothing</span> <span class="keyword">to</span> <span class="keyword">commit</span>, working directory clean</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>证明当前所有文件已经提交到本地仓库，工作目录是干净的 5.查看git日志</p>
                  <figure class="highlight 1c">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">log</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">commit aca3fe6cc3f49ded922d05e4774561f33697f710</span><br><span class="line">Author: Qingcai Cui &lt;<span class="symbol">1016903103@</span>qq.com&gt;</span><br><span class="line">Date: Sun Nov <span class="number">2</span> <span class="number">12</span>:<span class="number">16</span>:<span class="number">25</span> <span class="number">2014</span> +<span class="number">0800</span></span><br><span class="line"></span><br><span class="line">v2</span><br><span class="line"></span><br><span class="line">commit <span class="number">90</span>eea044b6da3818770ec482df98bb05ab569472</span><br><span class="line">Author: Qingcai Cui &lt;<span class="symbol">1016903103@</span>qq.com&gt;</span><br><span class="line">Date: Sun Nov <span class="number">2</span> <span class="number">12</span>:<span class="number">07</span>:<span class="number">46</span> <span class="number">2014</span> +<span class="number">0800</span></span><br><span class="line"></span><br><span class="line">v1</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>证明当前我们已经commit了两次，上面的为最近提交的。 如果嫌输出太多可以尝试下面的命令，一行显示</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">log</span> <span class="comment">--pretty=oneline</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果如下：</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">aca3fe6cc3f49ded922d05e4774561f33697f710</span> <span class="built_in">v2</span></span><br><span class="line"><span class="number">90</span>eea044b6da3818770ec482df98bb05ab569472 <span class="built_in">v1</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>一大串类似的</p>
                  <figure class="highlight dns">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">aca3fe6cc3f49ded922d05e4774561f<span class="number">33697f710</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>是commit id（版本号），和SVN不一样，Git的 commit id 不是1，2，3……递增的数字，而是一个SHA1计算出来的一个非常大的数字，用十六进制表示，而且你看到的commit id和我的肯定不一样，以你自己的为准。为什么commit id需要用这么一大串数字表示呢？因为Git是分布式的版本控制系统，后面我们还要研究多人在同一个版本库里工作，如果大家都用1，2，3……作为版本号，那肯定就冲突了。 6.版本回退 回退到上一版本：</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard HEAD^</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>回退到上上个版本：</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard HEAD^^</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>如果回退的版本过多则不用加那么多的^号 比如回退到上10版本，则可以用下面的命令</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard HEAD~10</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>回退1个版本相当于</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard HEAD~1</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>不过现在利用git status来查看已经看不到刚才那个版本了，想要返回的话怎么办 可以仍然用上面的方法</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard aca3f</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>只要写前几位就好了，git会自动去匹配的。当然前提是你的命令行窗口没有关闭还能找到之前的commit id。 不过万一你的命令行关闭了也没关系，git提供了一个方法来记录你的每一次命令。</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">ref</span>log</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">aca3fe6 <span class="symbol">HEAD@</span>&#123;<span class="number">0</span>&#125;: reset: moving to aca3f</span><br><span class="line"><span class="number">90</span>eea04 <span class="symbol">HEAD@</span>&#123;<span class="number">1</span>&#125;: reset: moving to HEAD^</span><br><span class="line">aca3fe6 <span class="symbol">HEAD@</span>&#123;<span class="number">2</span>&#125;: commit: jj</span><br><span class="line"><span class="number">90</span>eea04 <span class="symbol">HEAD@</span>&#123;<span class="number">3</span>&#125;: commit (initial): aa</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>在前方仍然显示了版本号，你仍然可以找到。仍然可以利用的reset命令来还原。 注意： A 工作区和暂存区的名词区别 工作区：就是你在电脑里能看到的目录 暂存区：在.git文件夹下存在一个暂存区stage和好多个分支比如master 当执行git add命令时，工作区的内容便会到stage暂存区中，当执行git commit命令时暂存区的内容便会提交到分支里面。 B “Git管理的是修改”的意思 比如第一次修改readme.txt，然后执行git add到暂存区，然后再修改readme.txt，然后执行git commit 到分支。 结果调用 git status 时发现现在仍然有一个modified文件，这是因为我们没有把新修改的文件提交到暂存区，所以导致分支中的文件和在工作区的原文不匹配。所以我们需要重新add和commit。这说明git管理的是”修改”,而不是”文件”本身。 7.撤销修改</p>
                  <figure class="highlight ada">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git checkout <span class="comment">-- filename</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>比如 git checkout — readme.txt 它的作用如下： 把 readme.txt 文件在工作区的修改全部撤销，这里有两种情况： 一种是 readme.txt 自修改后还没有被放到暂存区，现在，撤销修改就回到和版本库一模一样的状态； 一种是 readme.txt 已经添加到暂存区后，又作了修改，现在，撤销修改就回到添加到暂存区后的状态。 总之，就是让这个文件回到最近一次 git commit 或 git add 时的状态。 那么上面的这个情况是我们提交或者没提交到暂存区之后又对源文件做的修改。 还有另一种情况，我们提交之后放到了暂存区，我们想把暂存区里面的文件撤销回来。 就用以下命令：</p>
                  <figure class="highlight sql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">reset</span> <span class="keyword">HEAD</span> readme.txt</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>就是将刚才的git add命令撤销，把暂存区中的内容撤销回到工作区。 当然，如果你不但add了，并且又commit了，那就只能进行版本回退了。在上面已经说过了。 总结： 场景1：当你改乱了工作区某个文件的内容，想直接丢弃工作区的修改时，用命令git checkout — file。 场景2：当你不但改乱了工作区某个文件的内容，还添加到了暂存区时，想丢弃修改，分两步，第一步用命令git reset HEAD file，就回到了场景1，第二步按场景1操作。 场景3：已经提交了不合适的修改到版本库时，想要撤销本次提交，进行版本回退，不过前提是没有推送到远程库。 8.删除文件 假如现在你新建了一个 hello.txt 文件,你已经add并commit到了本地分支之中。 现在你想删除，如果直接执行</p>
                  <figure class="highlight css">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="selector-tag">rm</span> <span class="selector-tag">hello</span><span class="selector-class">.txt</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>则是只把工作区中的文件删除了，本地分支中没有删除，现在你执行git status 则会提示当前工作区已删除了一个文件，本地分支仍然存在，就存在了工作区和本地分支不同步的问题，现在我们如果想恢复一下，就利用下面的命令</p>
                  <figure class="highlight ada">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git checkout <span class="comment">-- hello.txt</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>将本地的文件一键还原。 假如我们真的是想将本地分支中的一个文件删除，那么我们就执行下面的方法。</p>
                  <figure class="highlight css">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="selector-tag">git</span> <span class="selector-tag">rm</span> <span class="selector-tag">hello</span><span class="selector-class">.txt</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>执行了这个命令之后，我们执行 git status 之后就会提示 你现在需要commit一下确认删除。 并且执行完这个命令之后，我们执行 ls 命令之后发现本地的文件也已经不存在了。 如果有很多个文件在本地被删除掉了，暂存区和工作区的文件完全不一样了，工作区删除掉了很多个文件，就会出现</p>
                  <figure class="highlight groovy">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">Changes not staged <span class="keyword">for</span> <span class="string">commit:</span></span><br><span class="line"><span class="string">deleted:</span> a.txt</span><br><span class="line"><span class="string">deleted:</span> b.txt</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>如果一个个地删除文件肯定特别麻烦，所以我们可以用下面的命令来</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">add</span><span class="bash"> -A</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>它等同于 git add . 和 git add -u</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">add</span><span class="bash"> . 保存所有新文件和改动的文件，不包括删除的文件</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">add</span><span class="bash"> -u  保存所有改动的文件和删除的文件，不包括新的文件</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>git add -A 和 git add -u 会把我们未通过 git rm 删除的文件全部stage 使用过以后运行 git status 便会出现 changes to be committed … 说明已经都经过git rm 删除了. 综上，我们想删除分支中的文件时就需要两条命令合起来使用</p>
                  <figure class="highlight nginx">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git</span> rm hello.txt</span><br><span class="line">git commit -m <span class="string">'rm hello.txt'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>要小心的是，执行 git rm 方法之后工作区和本地分支中的文件已经都不存在了。所以如果你已经在远程仓库存在备份的话，你就不用担心误删了。否则你就要小心了，会丢失这个文件的。 对比修改的文件</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git diff</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>结果：</p>
                  <figure class="highlight angelscript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">diff --git a/readme.txt b/readme.txt</span><br><span class="line">index <span class="number">9</span>c58532.<span class="number">.8</span>ce5f7e <span class="number">100644</span></span><br><span class="line">--- a/readme.txt</span><br><span class="line">+++ b/readme.txt</span><br><span class="line">@@ <span class="number">-1</span> +<span class="number">1</span> @@</span><br><span class="line">-git <span class="keyword">is</span> grea</span><br><span class="line">+hello <span class="keyword">is</span> grea</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>-号开头的语句代表这句话删除掉了 +号开头的语句代表这句话为新增语句 9.分支 新建本地分支</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">git</span> <span class="keyword">branch </span>dev</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>切换到dev分支</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git checkout dev</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>创建并切换到该分支</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">git</span> checkout -<span class="keyword">b </span>dev</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>查看本地分支</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git branch</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>比如此命令会输出 * master hello 代表当前已经选中了master分支，存在本地两个分支master和hello 合并分支</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git branch <span class="literal">master</span></span><br><span class="line">git merge hello</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样我们就把 master 分支合并到了hello分支了。 接下来我们就可以删除本地分支了。 既然分支合并这么简单，它可不可能出现什么问题呢？当然有，当然会出现分支合并冲突的问题。 比如我切换到了hello分支并修改了一个文件 add并且commit，然后我切换回了master分支 同样修改了这个文件，add并且commit。现在我们如果执行git merge hello 则会报一个提示说 分支合并冲突。 我们查看刚才修改的文件发现已经发生了变化，我们需要手动修改完了之后，然后继续add和commit才可以。如果没有add和commit，那么我们无法切换回原来的分支的。 add和commit之后，原来的hello分支仍然保持了原来不变，只不过是我们的master分支改变了。下面示意图则清楚地表示出了如下关系，图中的feature1相当于hello分支。 合并之后，我们就可以进行删除分支了，可以删除掉hello分支。 <a href="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/01.png" target="_blank" rel="noopener"><img src="http://qiniu.cuiqingcai.com/wp-content/uploads/2014/11/01.png" alt="0"></a> 其实上面的一系列操作 从merge到修改 然后add 然后commit 其实可以利用一条命令来修改,这个方法叫禁用Fast Forward模式 刚才的一系列命令如下</p>
                  <figure class="highlight livecodeserver">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git checkout master</span><br><span class="line">git <span class="built_in">merge</span> hello</span><br><span class="line">vi <span class="built_in">file</span>.txt</span><br><span class="line">git <span class="built_in">add</span> <span class="built_in">file</span>.txt</span><br><span class="line">git commit -m <span class="string">'merge master'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>那么利用下面的语句同样可以达成同样的效果</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git checkout <span class="literal">master</span></span><br><span class="line">git merge --no-ff -m 'merge <span class="literal">master</span>' hello</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>因为本次合并要创建一个新的commit，所以加上 -m 参数，把commit描述写进去。 Git就会在merge时生成一个新的commit，这样，从分支历史上就可以看出分支信息。 结束之后我们照样可以删除hello分支。 删除本地分支</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">git</span> <span class="keyword">branch </span>-d hello</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>查看远程分支</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">git</span> <span class="keyword">branch </span>-r</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>查看本地和远程分支</p>
                  <figure class="highlight armasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">git</span> <span class="keyword">branch </span>-a</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>现在遇到一个问题，我们正在工作的一个分支还没有做完，不能add或者commit，但是现在有一个bug需要在另一个分支上去修复，那么我们就需要暂时存储当前的分支。所以就要用到下面的命令</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git stash</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>当我们处理完其他的事情之后，再切换回来此分支。 先使用</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git stash <span class="built_in">list</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>再取出stash列表中的内容</p>
                  <figure class="highlight avrasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git stash <span class="keyword">pop</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>上面的方法既取出了list内容，并且把list中的元素删除掉。 强行删除分支</p>
                  <figure class="highlight haxe">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git branch -D <span class="keyword">new</span><span class="type"></span>-branch</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>10.多人协作 多人协作的工作模式通常是这样： 首先，可以试图用</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> <span class="built_in">origin</span> branch-name</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>推送自己的修改； 如果推送失败，则因为远程分支比你的本地更新，需要先用git pull试图合并； 如果合并有冲突，则解决冲突，并在本地提交； 没有冲突或者解决掉冲突后，再用</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> <span class="built_in">origin</span> branch-name</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>推送就能成功！ 如果git pull提示“no tracking information”，则说明本地分支和远程分支的链接关系没有创建，用命令</p>
                  <figure class="highlight delphi">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git branch --<span class="keyword">set</span>-upstream branch-<span class="keyword">name</span> origin/branch-<span class="keyword">name</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这就是多人协作的工作模式，一旦熟悉了，就非常简单。 11.添加远程地址别名</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git remote <span class="keyword">add</span><span class="bash"> origin git@github.com</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>删除远程地址别名</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git remote rm origin</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>此方法删除掉origin这个地址别名 查看远程地址别名</p>
                  <figure class="highlight ebnf">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attribute">git remote -v</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>推送到远程分支 我们在github上新建一个项目 添加远程仓库</p>
                  <figure class="highlight dockerfile">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git remote <span class="keyword">add</span><span class="bash"> origin  git@github.com:cqcre/gittest.git</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>推送上去</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> -u <span class="built_in">origin</span> master</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>加上了 -u 参数，Git不但会把本地的 master 分支内容推送的远程新的 master 分支，还会把本地的 master 分支和远程的 master 分支关联起来，即相当于推送到了一个默认的分支，在以后的推送或者拉取时就可以简化命令。 那么以后我们就不需要关联了，以后推送的话我们只需要输入</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> <span class="built_in">origin</span> master</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>克隆远程仓库 假设现在已经存在了一个远程仓库，我们需要把这个仓库克隆到本地，我们需要使用下面的方法</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">clone</span> <span class="title">git</span>@github.com:cqcre/test.git</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这样我们就把远程的一个仓库取到了本地了。 12.强制操作 强制覆盖本地分支内容</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">fetch</span> <span class="comment">--all</span></span><br><span class="line">git <span class="keyword">reset</span> <span class="comment">--hard origin/master</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>强制覆盖远程内容</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git push origin <span class="keyword">master</span> <span class="title">--force</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>13.修改commit的备注 有时候我们commit的备注写错了，需要重新修改，可以利用如下命令</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">commit</span> <span class="comment">--amend</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>14. .gitignore的使用 在git中如果想忽略掉某个文件，不让这个文件提交到版本库中，可以使用修改根目录中 .gitignore 文件的方法（如无，则需自己手工建立此文件）。这个文件每一行保存了一个匹配的规则例如：</p>
                  <figure class="highlight crystal">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">*.a <span class="comment"># 忽略所有 .a 结尾的文件</span></span><br><span class="line"> !<span class="class"><span class="keyword">lib</span>.<span class="title">a</span> <span class="comment"># 但 lib.a 除外</span></span></span><br><span class="line"> /TODO <span class="comment"># 仅仅忽略项目根目录下的 TODO 文件，不包括 subdir/TODO</span></span><br><span class="line"> build/ <span class="comment"># 忽略 build/ 目录下的所有文件</span></span><br><span class="line"> doc/*.txt <span class="comment"># 会忽略 doc/notes.txt 但不包括 doc/server/arch.txt</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>规则很简单，不做过多解释，但是有时候在项目开发过程中，突然心血来潮想把某些目录或文件加入忽略规则，按照上述方法定义后发现并未生效，原因是.gitignore只能忽略那些原来没有被track的文件，如果某些文件已经被纳入了版本管理中，则修改.gitignore是无效的。那么解决方法就是先把本地缓存删除（改变成未track状态），然后再提交：</p>
                  <figure class="highlight pgsql">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git rm -r <span class="comment">--cached .</span></span><br><span class="line">git <span class="keyword">add</span> .</span><br><span class="line">git <span class="keyword">commit</span> -m <span class="string">'update .gitignore'</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>15. 打tag 在发布版本的时候，经常会用到打标签的方法。 增加一个标签</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">tag</span> <span class="title">-a</span> <span class="string">"v1.0.0"</span> -m <span class="string">"Version 1.0.0"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>删除一个标签</p>
                  <figure class="highlight crmsh">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">tag</span> <span class="title">-d</span> v1.<span class="number">0.0</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>删除远程标签</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> --<span class="built_in">delete</span> <span class="built_in">origin</span> v1<span class="number">.0</span><span class="number">.0</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>推送所有标签</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="built_in">push</span> <span class="built_in">origin</span> --tags</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>16. 删除未监视文件</p>
                  <figure class="highlight properties">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">git</span> <span class="string">clean -f</span></span><br><span class="line"> </span><br><span class="line"><span class="comment"># 连 untracked 的目录也一起删掉</span></span><br><span class="line"><span class="attr">git</span> <span class="string">clean -fd</span></span><br><span class="line"> </span><br><span class="line"><span class="comment"># 连 gitignore 的untrack 文件/目录也一起删掉 （慎用，一般这个是用来删掉编译出来的 .o之类的文件用的）</span></span><br><span class="line"><span class="attr">git</span> <span class="string">clean -xfd</span></span><br><span class="line"> </span><br><span class="line"><span class="comment"># 在用上述 git clean 前，墙裂建议加上 -n 参数来先看看会删掉哪些文件，防止重要文件被误删</span></span><br><span class="line"><span class="attr">git</span> <span class="string">clean -nxfd</span></span><br><span class="line"><span class="attr">git</span> <span class="string">clean -nf</span></span><br><span class="line"><span class="attr">git</span> <span class="string">clean -nfd</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>17. 子模块</p>
                  <figure class="highlight mipsasm">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">git <span class="keyword">clone </span>&lt;repository&gt; --recursive 递归的方式克隆整个项目</span><br><span class="line">git <span class="keyword">submodule </span><span class="keyword">add </span>&lt;repository&gt; &lt;path&gt; 添加子模块</span><br><span class="line">git <span class="keyword">submodule </span>init 初始化子模块</span><br><span class="line">git <span class="keyword">submodule </span>update 更新子模块</span><br><span class="line">git <span class="keyword">submodule </span>foreach git pull 拉取所有子模块</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-11-01 23:53:13" itemprop="dateCreated datePublished" datetime="2014-11-01T23:53:13+08:00">2014-11-01</time>
                </span>
                <span id="/297.html" class="post-meta-item leancloud_visitors" data-flag-title="Git常用命令总结" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>7k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>6 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/294.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/294.html" class="post-title-link" itemprop="url">WordPress利用FitVids让视频完美适配电脑与手机</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>视频大小适配是个头疼的问题。之前利用了Advanced Responsive Video Embedder 这个插件结果发现还是手机端显示有些问题，不能正常播放，这下我们利用FitVids来做到电脑和手机适配。已经完美解决 这次我们不用加任何插件，完全可以用JS代码来实现。首先，我们需要在主题的js目录下创建一个js文件，名字叫做 jquery.fitvids.js 加入如下代码，然后保存。</p>
                  <figure class="highlight javascript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="comment">/*global jQuery */</span></span><br><span class="line"><span class="comment">/*jshint browser:true */</span></span><br><span class="line"><span class="comment">/*!</span></span><br><span class="line"><span class="comment">* FitVids 1.1</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com</span></span><br><span class="line"><span class="comment">* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/</span></span><br><span class="line"><span class="comment">* Released under the WTFPL license - http://sam.zoy.org/wtfpl/</span></span><br><span class="line"><span class="comment">*</span></span><br><span class="line"><span class="comment">*/</span></span><br><span class="line"></span><br><span class="line">(<span class="function"><span class="keyword">function</span>(<span class="params"> $ </span>)</span>&#123;</span><br><span class="line"></span><br><span class="line"><span class="meta"> 'use strict'</span>;</span><br><span class="line"></span><br><span class="line"> $.fn.fitVids = <span class="function"><span class="keyword">function</span>(<span class="params"> options </span>) </span>&#123;</span><br><span class="line"> <span class="keyword">var</span> settings = &#123;</span><br><span class="line"> customSelector: <span class="literal">null</span>,</span><br><span class="line"> ignore: <span class="literal">null</span></span><br><span class="line"> &#125;;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span>(!<span class="built_in">document</span>.getElementById(<span class="string">'fit-vids-style'</span>)) &#123;</span><br><span class="line"> <span class="comment">// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js</span></span><br><span class="line"> <span class="keyword">var</span> head = <span class="built_in">document</span>.head || <span class="built_in">document</span>.getElementsByTagName(<span class="string">'head'</span>)[<span class="number">0</span>];</span><br><span class="line"> <span class="keyword">var</span> css = <span class="string">'.fluid-width-video-wrapper&#123;width:100%;position:relative;padding:0;&#125;.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed &#123;position:absolute;top:0;left:0;width:100%;height:100%;&#125;'</span>;</span><br><span class="line"> <span class="keyword">var</span> div = <span class="built_in">document</span>.createElement(<span class="string">"div"</span>);</span><br><span class="line"> div.innerHTML = <span class="string">'&lt;p&gt;x&lt;/p&gt;&lt;style id="fit-vids-style"&gt;'</span> + css + <span class="string">'&lt;/style&gt;'</span>;</span><br><span class="line"> head.appendChild(div.childNodes[<span class="number">1</span>]);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> ( options ) &#123;</span><br><span class="line"> $.extend( settings, options );</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">return</span> <span class="keyword">this</span>.each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line"> <span class="keyword">var</span> selectors = [</span><br><span class="line"> <span class="string">'iframe[src*="player.vimeo.com"]'</span>,</span><br><span class="line"> <span class="string">'iframe[src*="youtube.com"]'</span>,</span><br><span class="line"> <span class="string">'iframe[src*="youtube-nocookie.com"]'</span>,</span><br><span class="line"> <span class="string">'iframe[src*="kickstarter.com"][src*="video.html"]'</span>,</span><br><span class="line"> <span class="string">'object'</span>,</span><br><span class="line"> <span class="string">'embed'</span></span><br><span class="line"> ];</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span> (settings.customSelector) &#123;</span><br><span class="line"> selectors.push(settings.customSelector);</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">var</span> ignoreList = <span class="string">'.fitvidsignore'</span>;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">if</span>(settings.ignore) &#123;</span><br><span class="line"> ignoreList = ignoreList + <span class="string">', '</span> + settings.ignore;</span><br><span class="line"> &#125;</span><br><span class="line"></span><br><span class="line"> <span class="keyword">var</span> $allVideos = $(<span class="keyword">this</span>).find(selectors.join(<span class="string">','</span>));</span><br><span class="line"> $allVideos = $allVideos.not(<span class="string">'object object'</span>); <span class="comment">// SwfObj conflict patch</span></span><br><span class="line"> $allVideos = $allVideos.not(ignoreList); <span class="comment">// Disable FitVids on this video.</span></span><br><span class="line"></span><br><span class="line"> $allVideos.each(<span class="function"><span class="keyword">function</span>(<span class="params"></span>)</span>&#123;</span><br><span class="line"> <span class="keyword">var</span> $<span class="keyword">this</span> = $(<span class="keyword">this</span>);</span><br><span class="line"> <span class="keyword">if</span>($<span class="keyword">this</span>.parents(ignoreList).length &gt; <span class="number">0</span>) &#123;</span><br><span class="line"> <span class="keyword">return</span>; <span class="comment">// Disable FitVids on this video.</span></span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">if</span> (<span class="keyword">this</span>.tagName.toLowerCase() === <span class="string">'embed'</span> &amp;&amp; $<span class="keyword">this</span>.parent(<span class="string">'object'</span>).length || $<span class="keyword">this</span>.parent(<span class="string">'.fluid-width-video-wrapper'</span>).length) &#123; <span class="keyword">return</span>; &#125;</span><br><span class="line"> <span class="keyword">if</span> ((!$<span class="keyword">this</span>.css(<span class="string">'height'</span>) &amp;&amp; !$<span class="keyword">this</span>.css(<span class="string">'width'</span>)) &amp;&amp; (<span class="built_in">isNaN</span>($<span class="keyword">this</span>.attr(<span class="string">'height'</span>)) || <span class="built_in">isNaN</span>($<span class="keyword">this</span>.attr(<span class="string">'width'</span>))))</span><br><span class="line"> &#123;</span><br><span class="line"> $<span class="keyword">this</span>.attr(<span class="string">'height'</span>, <span class="number">9</span>);</span><br><span class="line"> $<span class="keyword">this</span>.attr(<span class="string">'width'</span>, <span class="number">16</span>);</span><br><span class="line"> &#125;</span><br><span class="line"> <span class="keyword">var</span> height = ( <span class="keyword">this</span>.tagName.toLowerCase() === <span class="string">'object'</span> || ($<span class="keyword">this</span>.attr(<span class="string">'height'</span>) &amp;&amp; !<span class="built_in">isNaN</span>(<span class="built_in">parseInt</span>($<span class="keyword">this</span>.attr(<span class="string">'height'</span>), <span class="number">10</span>))) ) ? <span class="built_in">parseInt</span>($<span class="keyword">this</span>.attr(<span class="string">'height'</span>), <span class="number">10</span>) : $<span class="keyword">this</span>.height(),</span><br><span class="line"> width = !<span class="built_in">isNaN</span>(<span class="built_in">parseInt</span>($<span class="keyword">this</span>.attr(<span class="string">'width'</span>), <span class="number">10</span>)) ? <span class="built_in">parseInt</span>($<span class="keyword">this</span>.attr(<span class="string">'width'</span>), <span class="number">10</span>) : $<span class="keyword">this</span>.width(),</span><br><span class="line"> aspectRatio = height / width;</span><br><span class="line"> <span class="keyword">if</span>(!$<span class="keyword">this</span>.attr(<span class="string">'id'</span>))&#123;</span><br><span class="line"> <span class="keyword">var</span> videoID = <span class="string">'fitvid'</span> + <span class="built_in">Math</span>.floor(<span class="built_in">Math</span>.random()*<span class="number">999999</span>);</span><br><span class="line"> $<span class="keyword">this</span>.attr(<span class="string">'id'</span>, videoID);</span><br><span class="line"> &#125;</span><br><span class="line"> $<span class="keyword">this</span>.wrap(<span class="string">'&lt;div class="fluid-width-video-wrapper"&gt;&lt;/div&gt;'</span>).parent(<span class="string">'.fluid-width-video-wrapper'</span>).css(<span class="string">'padding-top'</span>, (aspectRatio * <span class="number">100</span>)+<span class="string">'%'</span>);</span><br><span class="line"> $<span class="keyword">this</span>.removeAttr(<span class="string">'height'</span>).removeAttr(<span class="string">'width'</span>);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;);</span><br><span class="line"> &#125;;</span><br><span class="line"><span class="comment">// Works with either jQuery or Zepto</span></span><br><span class="line">&#125;)( <span class="built_in">window</span>.jQuery || <span class="built_in">window</span>.Zepto );</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>接下来我们要修改functions.php文件咯 加入如下代码</p>
                  <figure class="highlight javascript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">add_fitvids</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line"> wp_register_script(<span class="string">'jquery_fitvids'</span>, get_template_directory_uri(). <span class="string">'/js/jquery.fitvids.js'</span>, array(<span class="string">'jquery'</span>), <span class="string">'2.0.110526'</span> );</span><br><span class="line"> wp_enqueue_script(<span class="string">'jquery_fitvids'</span>);</span><br><span class="line"> add_action(<span class="string">'wp_head'</span>, <span class="string">'add_fitthem'</span>);</span><br><span class="line"> <span class="function"><span class="keyword">function</span> <span class="title">add_fitthem</span>(<span class="params"></span>) </span>&#123; ?&gt;</span><br><span class="line"> &lt;script type=<span class="string">"text/javascript"</span>&gt;</span><br><span class="line"> jQuery(<span class="built_in">document</span>).ready( <span class="function"><span class="keyword">function</span>(<span class="params"></span>) </span>&#123;</span><br><span class="line"> jQuery(<span class="string">'.video'</span>).fitVids();</span><br><span class="line"> &#125;);</span><br><span class="line"> &lt;<span class="regexp">/script&gt;&lt;?php</span></span><br><span class="line"><span class="regexp"> &#125;</span></span><br><span class="line"><span class="regexp">&#125;</span></span><br><span class="line"><span class="regexp">add_action('wp_enqueue_scripts', 'add_fitvids');</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>这段代码就是引入了上面我们放入的js文件，并在WordPress模板加载的时候进行初始化设置。 然后我们加入一段代码对某些模仿器进行适配。 针对YouTube或Vimeo等支持oembed的视频源，我们再在functions.php加入如下代码来进行控制</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">add_embed_filter</span><span class="params">( $html )</span> </span>&#123;</span><br><span class="line"> $return = <span class="string">'&lt;div class="video"&gt;'</span> . $html . <span class="string">'&lt;/div&gt;'</span>;</span><br><span class="line"> <span class="keyword">return</span> $return;</span><br><span class="line">&#125;</span><br><span class="line">add_filter(<span class="string">'oembed_dataparse'</span>, <span class="string">'add_embed_filter'</span>);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>对于国内的一些视频网站，视频源为embed，我们再在functions.php加入如下代码来控制</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">add_oembed_filter</span><span class="params">( $html )</span> </span>&#123;</span><br><span class="line"> $return = <span class="string">'&lt;div class="video"&gt;'</span> . $html . <span class="string">'&lt;/div&gt;'</span>;</span><br><span class="line"> <span class="keyword">return</span> $return;</span><br><span class="line">&#125;</span><br><span class="line">add_filter(<span class="string">'embed_youku'</span>, <span class="string">'add_oembed_filter'</span>);</span><br><span class="line">add_filter(<span class="string">'embed_56com'</span>, <span class="string">'add_oembed_filter'</span>);</span><br><span class="line">add_filter(<span class="string">'embed_tudou'</span>, <span class="string">'add_oembed_filter'</span>);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>我们在发布视频时只需要在外面套2行代码就行啦。 比如我的一个视频是从土豆获取来的HTML代码，源代码为</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;embed <span class="attribute">src</span>=<span class="string">"http://www.tudou.com/v/bL4ioykS6ho/&amp;amp;resourceId=0_05_02_99/v.swf"</span> <span class="attribute">type</span>=<span class="string">"application/x-shockwave-flash"</span> <span class="attribute">width</span>=<span class="string">"300"</span> <span class="attribute">height</span>=<span class="string">"150"</span>&gt;&lt;/embed&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>那么我们在发布时只需要在外面套一层div就OK了</p>
                  <figure class="highlight applescript">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;<span class="keyword">div</span> <span class="built_in">class</span>=<span class="string">"video"</span>&gt;</span><br><span class="line">....</span><br><span class="line">&lt;/<span class="keyword">div</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>最后的代码如下</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;div <span class="attribute">class</span>=<span class="string">"video"</span>&gt;&lt;embed <span class="attribute">src</span>=<span class="string">"http://www.tudou.com/v/bL4ioykS6ho/&amp;amp;resourceId=0_05_02_99/v.swf"</span> <span class="attribute">type</span>=<span class="string">"application/x-shockwave-flash"</span> <span class="attribute">width</span>=<span class="string">"300"</span> <span class="attribute">height</span>=<span class="string">"150"</span>&gt;&lt;/embed&gt;&lt;/div&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>在文章中的HTML代码编辑器中插入如上代码即可实现手机端和电脑端的视频完美适配。 以上就是利用Fitvids来对视频进行适配操作的全部过程。</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-10-30 20:37:24" itemprop="dateCreated datePublished" datetime="2014-10-30T20:37:24+08:00">2014-10-30</time>
                </span>
                <span id="/294.html" class="post-meta-item leancloud_visitors" data-flag-title="WordPress利用FitVids让视频完美适配电脑与手机" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>4.8k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>4 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/260.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> 个人展示 <i class="label-arrow"></i>
                  </a>
                  <a href="/260.html" class="post-title-link" itemprop="url">江南之行</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>2013年3月底，我的大一，我的轮滑社团，我的江南之行，我的所见所想，我的心灵感悟。</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-10-29 23:04:15" itemprop="dateCreated datePublished" datetime="2014-10-29T23:04:15+08:00">2014-10-29</time>
                </span>
                <span id="/260.html" class="post-meta-item leancloud_visitors" data-flag-title="江南之行" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>42</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/160.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> C/C++ <i class="label-arrow"></i>
                  </a>
                  <a href="/160.html" class="post-title-link" itemprop="url">Eclipse下配置Winpcap环境</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>大家好，本节为大家带来在Eclipse下配置Winpcap环境，欢迎大家收看。 首先，配置Winpcap环境的前提是你必须配置好了Eclipse下的C/C++环境。如果你还没有配置，欢迎大家收看上节内容进行配置。 链接地址：<a href="http://blog.csdn.net/cqcre/article/details/39754251" target="_blank" rel="noopener">Eclipse配置C/C++环境</a> 若链接失效，请自行查看上一篇文章或者百度其他文章。 废话不多说啦，开始我们的Winpcap的配置。 1.Winpcap的下载 Winpcap官网：<a href="http://www.winpcap.org/" target="_blank" rel="noopener">Winpcap官网</a> Winpcap目前最新版为4.1.3,首先你要下载exe文件并安装，直接双击运行安装即可。 下载地址：<a href="http://www.winpcap.org/install/default.htm" target="_blank" rel="noopener">Winpcap4.1.3.exe</a> 然后你需要下载开发包，首先必须注意的是，目前最新版本是没有开发包的，最新的开发包为4.1.2，先见下图 <img src="http://img.blog.csdn.net/20141003120936027?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 下面的红色框说明了目前没有提供Winpcap4.1.3的开发包，最新版本的开发包是4.1.2，他可以与4.1.3的Winpcap配套使用。 所以下载4.1.2的开发包。 下载地址：<a href="http://www.winpcap.org/devel.htm" target="_blank" rel="noopener">Winpcap Developer’s Pack 4.1.2</a> 2.Eclipse中的相关配置 首先新建一个C 的项目，具体的建立过程可以参见上一节的内容。 我们加入一个测试代码如下：</p>
                  <figure class="highlight cpp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">#<span class="meta-keyword">define</span> WIN32</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> HAVE_REMOTE</span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">"pcap.h"</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">"Win32-Extensions.h"</span></span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">gen_packet</span><span class="params">(<span class="keyword">unsigned</span> <span class="keyword">char</span> *buf,<span class="keyword">int</span> len)</span></span>;</span><br><span class="line"></span><br><span class="line"><span class="comment">/*生成数据包*/</span></span><br><span class="line"><span class="function"><span class="keyword">void</span> <span class="title">gen_packet</span><span class="params">(<span class="keyword">unsigned</span> <span class="keyword">char</span> *buf,<span class="keyword">int</span> len)</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">		<span class="keyword">int</span> i=<span class="number">0</span>;</span><br><span class="line"></span><br><span class="line">		<span class="comment">//设置目标MAC地址为01:01:01:01:01:01</span></span><br><span class="line">		<span class="keyword">for</span> (i=<span class="number">0</span>;i&lt;<span class="number">6</span>;i++)</span><br><span class="line">		&#123;</span><br><span class="line">			buf[i]=<span class="number">0x01</span>;</span><br><span class="line">		&#125;</span><br><span class="line"></span><br><span class="line">		<span class="comment">//设置源MAC地址为02:02:02:02:02:02</span></span><br><span class="line">		<span class="keyword">for</span> (i=<span class="number">6</span>;i&lt;<span class="number">12</span>;i++)</span><br><span class="line">		&#123;</span><br><span class="line">			buf[i]=<span class="number">0x02</span>;</span><br><span class="line">		&#125;</span><br><span class="line"></span><br><span class="line">		<span class="comment">//设置协议标识为0xc0xd，无任何实际意义</span></span><br><span class="line">		buf[<span class="number">12</span>]=<span class="number">0xc</span>;</span><br><span class="line">		buf[<span class="number">13</span>]=<span class="number">0xd</span>;</span><br><span class="line"></span><br><span class="line">		<span class="comment">//填充数据包的内容</span></span><br><span class="line">		<span class="keyword">for</span>(i=<span class="number">14</span>;i&lt;len;i++)</span><br><span class="line">		&#123;</span><br><span class="line">			buf[i]=i<span class="number">-14</span>;</span><br><span class="line">		&#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">	<span class="keyword">pcap_if_t</span> *alldevs;</span><br><span class="line">	<span class="keyword">pcap_if_t</span> *d;</span><br><span class="line">	<span class="keyword">int</span> inum;</span><br><span class="line">	<span class="keyword">int</span> i=<span class="number">0</span>;</span><br><span class="line">	<span class="keyword">pcap_t</span> *adhandle;</span><br><span class="line">	<span class="keyword">char</span> errbuf[PCAP_ERRBUF_SIZE];</span><br><span class="line">	<span class="keyword">int</span> ret=<span class="number">-1</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 获取本机网络设备列表 */</span></span><br><span class="line">    <span class="keyword">if</span> (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, <span class="literal">NULL</span>, &amp;alldevs, errbuf) == <span class="number">-1</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">fprintf</span>(<span class="built_in">stderr</span>,<span class="string">"Error in pcap_findalldevs: %s\n"</span>, errbuf);</span><br><span class="line">        <span class="built_in">exit</span>(<span class="number">1</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 打印网络设备列表 */</span></span><br><span class="line">    <span class="keyword">for</span>(d=alldevs; d; d=d-&gt;next)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"%d. %s"</span>, ++i, d-&gt;name);</span><br><span class="line">        <span class="keyword">if</span> (d-&gt;description)</span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">" (%s)\n"</span>, d-&gt;description);</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">" (No description available)\n"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(i==<span class="number">0</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"\nNo interfaces found! Make sure WinPcap is installed.\n"</span>);</span><br><span class="line">        <span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/*选择网络设备接口*/</span></span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">"Enter the interface number (1-%d):"</span>,i);</span><br><span class="line">    <span class="built_in">scanf</span>(<span class="string">"%d"</span>, &amp;inum);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span>(inum &lt; <span class="number">1</span> || inum &gt; i)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"\nInterface number out of range.\n"</span>);</span><br><span class="line">        <span class="comment">/* 释放设备列表 */</span></span><br><span class="line">        pcap_freealldevs(alldevs);</span><br><span class="line">        <span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 跳转到选中的适配器 */</span></span><br><span class="line">    <span class="keyword">for</span>(d=alldevs, i=<span class="number">0</span>; i&lt; inum<span class="number">-1</span> ;d=d-&gt;next, i++);</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 打开设备 */</span></span><br><span class="line">    <span class="keyword">if</span> ( (adhandle= pcap_open(d-&gt;name,          <span class="comment">// 设备名</span></span><br><span class="line">							  <span class="number">65536</span>,            <span class="comment">// 65535保证能捕获到数据链路层上每个数据包的全部内容</span></span><br><span class="line">							  PCAP_OPENFLAG_PROMISCUOUS,    <span class="comment">// 混杂模式</span></span><br><span class="line">                              <span class="number">1000</span>,             <span class="comment">// 读取超时时间</span></span><br><span class="line">                              <span class="literal">NULL</span>,             <span class="comment">// 远程机器验证</span></span><br><span class="line">                              errbuf            <span class="comment">// 错误缓冲池</span></span><br><span class="line">                              ) ) == <span class="literal">NULL</span>)</span><br><span class="line">    &#123;</span><br><span class="line">        <span class="built_in">fprintf</span>(<span class="built_in">stderr</span>,<span class="string">"\nUnable to open the adapter. %s is not supported by WinPcap\n"</span>, d-&gt;name);</span><br><span class="line">        <span class="comment">/* 释放设备列表 */</span></span><br><span class="line">        pcap_freealldevs(alldevs);</span><br><span class="line">        <span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/*在选中的设备接口上发送数据*/</span></span><br><span class="line">    <span class="built_in">printf</span>(<span class="string">"\nsending on %s...\n"</span>, d-&gt;description);</span><br><span class="line"></span><br><span class="line">    <span class="comment">/* 发送数据包*/</span></span><br><span class="line">	<span class="comment">//生成数据报</span></span><br><span class="line">	<span class="keyword">int</span> packetlen=<span class="number">100</span>;</span><br><span class="line">	<span class="keyword">unsigned</span> <span class="keyword">char</span> *buf= (<span class="keyword">unsigned</span> <span class="keyword">char</span> *)<span class="built_in">malloc</span>(packetlen);</span><br><span class="line">	<span class="built_in">memset</span>(buf,<span class="number">0x0</span>,packetlen);</span><br><span class="line">	gen_packet(buf,packetlen); <span class="comment">//获得生成的数据包，长度为packetlen</span></span><br><span class="line">	<span class="comment">//开始数据包发送</span></span><br><span class="line">	<span class="keyword">if</span> ( (ret=pcap_sendpacket(adhandle,buf,packetlen))==<span class="number">-1</span>)</span><br><span class="line">	&#123;</span><br><span class="line">		<span class="built_in">printf</span>(<span class="string">"发送失败\n"</span>);</span><br><span class="line">		<span class="built_in">free</span>(buf);</span><br><span class="line">		pcap_close(adhandle);</span><br><span class="line">        pcap_freealldevs(alldevs);</span><br><span class="line">        <span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">	&#125;</span><br><span class="line"></span><br><span class="line">	 <span class="comment">/*释放资源*/</span></span><br><span class="line">	 <span class="built_in">free</span>(buf);</span><br><span class="line">	 pcap_close(adhandle);</span><br><span class="line">	 pcap_freealldevs(alldevs);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>把代码拷贝到你的项目程序里面，可以发现现在是编译错误，有些对象根本无法识别，截图如下： <img src="http://img.blog.csdn.net/20141003121756538?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 接下来就需要我们对类库进行配置啦。 首先解压你下载的开发包，随便放硬盘的某个位置，我放在了D盘的eclipse_plugins文件夹中，当然你可以随便放哪里都行。 <img src="http://img.blog.csdn.net/20141003122134034?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 接下来配置Eclipse，右键项目-&gt;属性-&gt;C/C++常规-&gt;项目和符号。 <img src="http://img.blog.csdn.net/20141003122332235?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 首先添加你的include库，在包含这个选项卡中添加你的库，点击添加-&gt;选择文件系统-&gt;选择你刚才的开发库的include文件夹，按照图中的顺序来 <img src="http://img.blog.csdn.net/20141003122614796?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> <img src="http://img.blog.csdn.net/20141003122856279?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 点击确定添加，同理在库路径选项卡中进行库路径的配置，这次添加的是lib文件夹。按照图片中的顺序来做 <img src="http://img.blog.csdn.net/20141003123234570?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> <img src="http://img.blog.csdn.net/20141003123311433?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 点击确定添加。 然后在库的选项卡中添加wpcap和Packet两个库，注意这次不能选择文件系统了，因为你指定了库路径之后它会自动搜索路径中库的名字，这次你 只需要指定库的名字就好了。我之前添加的是文件系统，然后它总是提示找不到这个库，所以一定要直接填写这两个库的名字。如图所示： <img src="http://img.blog.csdn.net/20141003123715375?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 添加完毕之后，出现这个样子： <img src="http://img.blog.csdn.net/20141003123823109?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 好啦，点击确定，全部配置已经完毕啦。 重新构建项目，运行即可。 注意，构建过程可能出现如下问题：</p>
                  <ul>
                    <li>error C2065: “PCAP_SRC_IF_STRING”: 未声明的标识符</li>
                    <li>error C3861: “pcap_findalldevs_ex”: 找不到标识符</li>
                    <li>error C2065: “PCAP_OPENFLAG_PROMISCUOUS”: 未声明的标识符</li>
                    <li>error C3861: “pcap_open”: 找不到标识符</li>
                  </ul>
                  <p>因为新的版本里WinPcap支持远程数据包获取，所以还应当添加一个头文件remote-ext.h ，即#include “remote-ext.h”（记住这条语句要放在#include “pcap.h”之后，否则会出错！） <img src="http://img.blog.csdn.net/20141003124531280?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 好了，一切问题都解决了，运行成功啦！ 运行结果如下： <img src="http://img.blog.csdn.net/20141003124547093?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 再附测试代码一例：</p>
                  <figure class="highlight cpp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="meta">#<span class="meta-keyword">define</span> WIN32</span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">define</span> HAVE_REMOTE</span></span><br><span class="line"></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">&lt;stdio.h&gt;</span></span></span><br><span class="line"><span class="meta">#<span class="meta-keyword">include</span> <span class="meta-string">"pcap.h"</span></span></span><br><span class="line"></span><br><span class="line"><span class="function"><span class="keyword">int</span> <span class="title">main</span><span class="params">()</span></span></span><br><span class="line"><span class="function"></span>&#123;</span><br><span class="line">    <span class="keyword">pcap_if_t</span> *alldevs;</span><br><span class="line">    <span class="keyword">pcap_if_t</span> *d;</span><br><span class="line">    <span class="keyword">int</span> i=<span class="number">0</span>;</span><br><span class="line">    <span class="keyword">char</span> errbuf[PCAP_ERRBUF_SIZE];</span><br><span class="line"></span><br><span class="line">    <span class="comment">//获取本地机器设备列表</span></span><br><span class="line">    <span class="keyword">if</span> (pcap_findalldevs_ex(PCAP_SRC_IF_STRING, <span class="literal">NULL</span> , &amp;alldevs, errbuf) == <span class="number">-1</span>)&#123;</span><br><span class="line">        <span class="comment">//获取设备列表失败，程序返回</span></span><br><span class="line">        <span class="built_in">fprintf</span>(<span class="built_in">stderr</span>,<span class="string">"Error in pcap_findalldevs_ex: %s\n"</span>, errbuf);</span><br><span class="line">        <span class="built_in">exit</span>(<span class="number">1</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//打印设备列表</span></span><br><span class="line">    <span class="keyword">for</span>(d= alldevs; d != <span class="literal">NULL</span>; d= d-&gt;next) &#123;</span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"%d. %s"</span>, ++i, d-&gt;name);</span><br><span class="line">        <span class="keyword">if</span> (d-&gt;description)</span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">" (%s)\n"</span>, d-&gt;description);</span><br><span class="line">        <span class="keyword">else</span></span><br><span class="line">            <span class="built_in">printf</span>(<span class="string">" (No description available)\n"</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">if</span> (i == <span class="number">0</span>)&#123;</span><br><span class="line">        <span class="comment">//没找到设备接口，确认WinPcap已安装，程序退出</span></span><br><span class="line">        <span class="built_in">printf</span>(<span class="string">"\nNo interfaces found! Make sure WinPcap is installed.\n"</span>);</span><br><span class="line">        <span class="keyword">return</span> <span class="number">-1</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//不再需要设备列表了，释放它</span></span><br><span class="line">    pcap_freealldevs(alldevs);</span><br><span class="line"></span><br><span class="line">    <span class="keyword">return</span> <span class="number">0</span>;</span><br><span class="line">&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>运行结果：</p>
                  <figure class="highlight maxima">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="number">1</span>. rpcap://\Device\NPF_&#123;5AC72F8D-<span class="number">019C</span>-<span class="number">4003</span>-B51B-7ABB67AF392A&#125; (Network adapter 'Microsoft' on <span class="built_in">local</span> host)</span><br><span class="line"><span class="number">2</span>. rpcap://\Device\NPF_&#123;33E23A2F-F791-<span class="number">409B-8452</span>-A3FB5A78B73E&#125; (Network adapter 'Qualcomm Atheros Ar81xx series PCI-E Ethernet Controller' on <span class="built_in">local</span> host)</span><br><span class="line"><span class="number">3</span>. rpcap://\Device\NPF_&#123;DCCF036F-A9A8-<span class="number">4225</span>-B980-D3A3F0575F5B&#125; (Network adapter 'Microsoft' on <span class="built_in">local</span> host)</span><br><span class="line"><span class="number">4</span>. rpcap://\Device\NPF_&#123;D62A0060-F424-46FC-83A5-3394081685FD&#125; (Network adapter 'Microsoft' on <span class="built_in">local</span> host)</span><br><span class="line"><span class="number">5</span>. rpcap://\Device\NPF_&#123;B5224A53-<span class="number">8450</span>-<span class="number">4537</span>-AB3B-9869158121CD&#125; (Network adapter 'Microsoft' on <span class="built_in">local</span> host)</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-10-19 18:18:41" itemprop="dateCreated datePublished" datetime="2014-10-19T18:18:41+08:00">2014-10-19</time>
                </span>
                <span id="/160.html" class="post-meta-item leancloud_visitors" data-flag-title="Eclipse下配置Winpcap环境" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>4.9k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>4 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/157.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/157.html" class="post-title-link" itemprop="url">PHP使用七牛云存储之图片的上传、下载、重定向教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>网上关于七牛云存储的教程除了官网上的API文档，其他的资料太少了。研究了下API之后，现在已经能实现图片的上传和下载及上传之后的重定向。 首先本篇文章实现的功能如下： 1.利用表单上传功能，用户可以点击选择文件按钮，选择本地的一个文件，同时设定上传的图片的名称，点击上传按钮可以上传并存储到七牛云存储。 2.在点击上传时会检测文件的后缀名，限制为jpg和png格式存储。 3.上传成功后跳转到自己设定的一个URL，并传回文件信息，如文件名。而不是显示七牛白花花的json显示页面。 好啦，那我们开始吧，首先我们要有一个七牛云存储账号，如果没有的就自己去申请吧。 七牛云存储传送门：<a href="http://www.qiniu.com/" target="_blank" rel="noopener">http://www.qiniu.com/</a> 一.SDK下载 <a href="https://github.com/qiniu/php-sdk/tags" target="_blank" rel="noopener">https://github.com/qiniu/php-sdk/tags</a> 戳这个网址下载一下SDK吧，里面封装了文件上传下载等等的方法，我们引入之后可以直接调用。 SDK之中有一个qiniu的文件夹，这是所有的SDK实货，这个是最重要的。我们首先要把这个文件夹及里面的文件放到项目文件夹中，比如我放到这里。 <img src="http://img.blog.csdn.net/20141001165000635?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 大家可以看到有一个qiniu文件夹。好啦，资源支持就是这样。接下来我们要实现代码咯。 二.文件的上传。 1.首先把你七牛云存储的密钥照出来，点击账号设置可以看到有一个AccessKey和SecretKey，留着备用。 2.上传凭证生成。 在这里我们首先要引入rs.php文件，自己找一对应路径，代码如下：</p>
                  <figure class="highlight lisp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">require_once(<span class="name">dirname</span>(<span class="name">__FILE__</span>).<span class="string">"/../../qiniu/rs.php"</span>)<span class="comment">;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>dirname()是指的绝对路径，有时相对路径会出现问题，建议在前面加上dirname方法获取绝对路径。 require_once是引入文件，表示该文件只引入一次。 然后，传入你的AccessKey和SecretKey 代码如下：</p>
                  <figure class="highlight arcade">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="symbol">$access</span>Key = <span class="string">'Imn35KC5pRX7Ov3scxbYkvNk6oIx7zWsBRp16'</span>;  <span class="comment">//换成你自己的密钥</span></span><br><span class="line"><span class="symbol">$secret</span>Key = <span class="string">'s29vc9tlCvs23wRh7QScYTuzCDmEroKj1ddssz'</span>;    <span class="comment">//换成你自己的密钥</span></span><br><span class="line">Qiniu_SetKeys(<span class="symbol">$access</span>Key, <span class="symbol">$secret</span>Key);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>然后建一个上传策略对象，将你的bucket 传入，bucket 就是你的空间名。</p>
                  <figure class="highlight lasso">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$bucket = <span class="string">'designpartners'</span>;</span><br><span class="line">$putPolicy = <span class="literal">new</span> Qiniu_RS_PutPolicy($bucket);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>然后调用此方法来生成上传凭证。</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$upToken = $putPolicy-&gt;Token(<span class="keyword">null</span>);</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>接下来就写一个html表单</p>
                  <figure class="highlight stata">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&lt;<span class="keyword">form</span> method=<span class="string">"post"</span> action=<span class="string">"http://up.qiniu.com"</span> name = <span class="string">"form"</span> enctype=<span class="string">"multipart/form-data"</span>&gt;</span><br><span class="line">    &lt;ul&gt;</span><br><span class="line">            &lt;<span class="keyword">input</span> <span class="keyword">type</span>=<span class="string">"hidden"</span>  id=<span class="string">"token"</span> name=<span class="string">"token"</span>  value=&lt;?php echo <span class="variable">$upToken</span>?&gt;&gt;</span><br><span class="line">        &lt;<span class="keyword">li</span>&gt;</span><br><span class="line">            &lt;<span class="keyword">label</span> <span class="keyword">for</span>=<span class="string">"key"</span>&gt;key:&lt;/<span class="keyword">label</span>&gt;</span><br><span class="line">            &lt;<span class="keyword">input</span> name=<span class="string">"key"</span> value=<span class="string">""</span>&gt;</span><br><span class="line">        &lt;/<span class="keyword">li</span>&gt;</span><br><span class="line">        &lt;<span class="keyword">li</span>&gt;</span><br><span class="line">            &lt;<span class="keyword">label</span> <span class="keyword">for</span>=<span class="string">"bucket"</span>&gt;照片:&lt;/<span class="keyword">label</span>&gt;</span><br><span class="line">            &lt;<span class="keyword">input</span> name=<span class="string">"file"</span>  <span class="keyword">type</span>=<span class="string">"file"</span> /&gt;</span><br><span class="line">        &lt;/<span class="keyword">li</span>&gt;</span><br><span class="line">        &lt;<span class="keyword">li</span>&gt;</span><br><span class="line">            &lt;<span class="keyword">input</span> <span class="keyword">type</span>=<span class="string">"submit"</span> value=<span class="string">"提交"</span> &gt;</span><br><span class="line">        &lt;/<span class="keyword">li</span>&gt;</span><br><span class="line">    &lt;/ul&gt;</span><br><span class="line">&lt;/<span class="keyword">form</span>&gt;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>action 就填写 up.qiniu.com，表单提供了一个输入框key，用来输入你想保存的图片名称，上传到七牛之后就是这个名字。 然后一个文件选择，一个提交按钮。运行结果如下： <img src="http://img.blog.csdn.net/20141001170634684?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 输入key值和选择照片即可实现照片的上传。哈哈哈有没有很简单。 三、文件下载 原理和文件上传功能相仿。 引入文件</p>
                  <figure class="highlight lisp">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">require_once(<span class="name">dirname</span>(<span class="name">__FILE__</span>).<span class="string">"/../../qiniu/rs.php"</span>)<span class="comment">;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>声明你的七牛云存储域名和两个密钥以及向下载的文件名称</p>
                  <figure class="highlight autoit">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$key = <span class="string">'00000'</span><span class="comment">;</span></span><br><span class="line">$domain = <span class="string">'designpartners.qiniudn.com'</span><span class="comment">;</span></span><br><span class="line">$accessKey = <span class="string">'IOImn35KC5p3scxbYkvNk6oIxB7zWsBRp16'</span><span class="comment">;</span></span><br><span class="line">$secretKey = <span class="string">'s29vc9tlCvs23wCDmIbUSi4EroKj1z'</span><span class="comment">;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>注意：1.key值即为文件名，不要加后缀 2.domain即为bucket加上qiniudn.com,例子中的designpartners就是我在上传图片时用的bucket名。 3.accessKey和secretKey换成你自己的，直接用我的不行的..因为我修改了.</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">Qiniu_SetKeys($accessKey, $secretKey);  </span><br><span class="line">$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);</span><br><span class="line">$getPolicy = <span class="keyword">new</span> Qiniu_RS_GetPolicy();</span><br><span class="line">$privateUrl = $getPolicy-&gt;MakeRequest($baseUrl, <span class="keyword">null</span>);</span><br><span class="line"><span class="keyword">echo</span> $privateUrl . <span class="string">"\n"</span>;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>传入这四个值即可生成一样url，直接访问url即可实现图片的下载。 在引入图片时直接</p>
                  <figure class="highlight xml">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="tag">&lt;<span class="name">img</span> <span class="attr">src</span> = <span class="string">"&lt;?php echo $privateUrl; ?&gt;"</span>/&gt;</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>即可引入图片咯，很简单的吧。 四、303重定向 在上面的方法中，我们上传图片成功后跳转到up.qiniu.com下，会显示白白的网页，显示一个json字符串，但是在实际网站开发中我们肯定 不能让用户看到这种网页，所以我们用到了303跳转。SDK中也为我们封装了这个方法。使用其实非常简单。在上传文件的代码中添加两行代码即可</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$putPolicy = <span class="keyword">new</span> Qiniu_RS_PutPolicy($bucket);</span><br><span class="line">$putPolicy-&gt;ReturnUrl = site_url().<span class="string">"/upload/receiveInfo"</span>;</span><br><span class="line">$putPolicy-&gt;ReturnBody=<span class="string">'&#123;"key": $(key)&#125;'</span>;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>注意：1. ReturnUrl和ReturnBody必须指定，并且首字母要大写，很多人都小写开头，这样会跳转不成功。 2.ReturnUrl必须是一个公网可以访问的网址，在本地测试是不可能通过的。比如你写成localhost，七牛服务器是定位不到的。 3.这个ReturnUrl的链接后会跟着一个?upload_ret=XXX，可以用get方法获取这个upload_ret。upload_ret的内容是base64安全编码的json形式的key值。 值的解析：比如我上传的文件名是555</p>
                  <figure class="highlight routeros">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">upload/receiveInfo?<span class="attribute">upload_ret</span>=eyJrZXkiOiAiNTU1In0=</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>网址后缀如上所示，把那个upload_ret复制下来，用base64解码可以出现如下结果：</p>
                  <figure class="highlight json">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">&#123;<span class="attr">"key"</span>: <span class="string">"555"</span>&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>所以，我们要获取555这个值的代码如下，即解析代码如下：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">$upload_ret = $_GET[<span class="string">'upload_ret'</span>];</span><br><span class="line">$json_ret = base64_decode($upload_ret);</span><br><span class="line">$result=json_decode($json_ret);</span><br><span class="line"><span class="keyword">echo</span> <span class="string">"key"</span>.$result-&gt;key;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>好啦，获取到这个key值之后，你可以选择存到数据库或者进行其他的操作咯。 五、上传前文件类型的验证 我们可以用js来验证文件的后缀名， 在form的属性里加上</p>
                  <figure class="highlight ini">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="attr">onsubmit</span>=<span class="string">"return isValidateFile('file');"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>加上一个js方法</p>
                  <figure class="highlight xquery">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">script</span>&gt;</span></span></span><br><span class="line"><span class="xml">	function isValidateFile(obj) </span><span class="xquery">&#123;</span></span><br><span class="line"><span class="xquery">		var extend =<span class="built_in"> document</span>.form.file.<span class="keyword">value</span><span class="built_in">.substring</span><span class="built_in">(document</span>.form.file.<span class="keyword">value</span>.lastIndexOf(<span class="string">"."</span>) + <span class="number">1</span>);</span></span><br><span class="line"><span class="xquery">		<span class="keyword">if</span> (extend == <span class="string">""</span>) &#123;</span></span><br><span class="line"><span class="xquery">			alert(<span class="string">"请选择头像"</span>);</span></span><br><span class="line"><span class="xquery">			<span class="keyword">return</span><span class="built_in"> false</span>;</span></span><br><span class="line"><span class="xquery">		&#125;</span></span><br><span class="line"><span class="xml">		else </span><span class="xquery">&#123;</span></span><br><span class="line"><span class="xquery">			<span class="keyword">if</span> (!(extend == <span class="string">"jpg"</span> || extend == <span class="string">"png"</span>)) &#123;</span></span><br><span class="line"><span class="xquery">			alert(<span class="string">"请上传后缀名为jpg或png的文件!"</span>);</span></span><br><span class="line"><span class="xquery">			<span class="keyword">return</span><span class="built_in"> false</span>;</span></span><br><span class="line"><span class="xquery">			&#125;</span></span><br><span class="line"><span class="xml">		&#125;</span></span><br><span class="line"><span class="xml">		return true;</span></span><br><span class="line"><span class="xml">	&#125;</span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>即可验证它的类型是否合法。 附：CI代码实现： 获取Uptoken：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="function"><span class="keyword">function</span> <span class="title">getUptoken</span><span class="params">()</span></span>&#123;</span><br><span class="line">		<span class="keyword">require_once</span>(dirname(<span class="keyword">__FILE__</span>).<span class="string">"/../../qiniu/rs.php"</span>);</span><br><span class="line">		<span class="comment">//远程存储空间名称</span></span><br><span class="line">		$bucket = <span class="string">'designpartners'</span>;</span><br><span class="line">		$accessKey = <span class="string">'IOImn35KCRX7Ov3scvNk6oIxB7zWsBRp16'</span>;</span><br><span class="line">		$secretKey = <span class="string">'s29vc9tlCvs23wRhTuzCDmIbUSi4EroKj1z'</span>;</span><br><span class="line">		Qiniu_SetKeys($accessKey, $secretKey);</span><br><span class="line">		$putPolicy = <span class="keyword">new</span> Qiniu_RS_PutPolicy($bucket);</span><br><span class="line">		<span class="keyword">echo</span> site_url();</span><br><span class="line">		$putPolicy-&gt;ReturnUrl = site_url().<span class="string">"/upload/receiveInfo"</span>;</span><br><span class="line">		$putPolicy-&gt;ReturnBody=<span class="string">'&#123;"key": $(key)&#125;'</span>;</span><br><span class="line">		$upToken = $putPolicy-&gt;Token(<span class="keyword">null</span>);</span><br><span class="line">		<span class="keyword">return</span> $upToken;</span><br><span class="line">	&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>文件上传：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">uploadPic</span><span class="params">()</span></span>&#123;</span><br><span class="line">		</span><br><span class="line">		$upToken = <span class="keyword">$this</span>-&gt;getUptoken();</span><br><span class="line">	        $data[<span class="string">'upToken'</span>] = $upToken;</span><br><span class="line">		<span class="keyword">$this</span>-&gt;load-&gt;view(<span class="string">'upload'</span>,$data);</span><br><span class="line">		</span><br><span class="line">	&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>303重定向解析：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">receiveInfo</span><span class="params">()</span></span>&#123;</span><br><span class="line">		$upload_ret = $_GET[<span class="string">'upload_ret'</span>];</span><br><span class="line">		$json_ret = base64_decode($upload_ret);</span><br><span class="line">		$result=json_decode($json_ret);</span><br><span class="line">		<span class="keyword">echo</span> <span class="string">"key"</span>.$result-&gt;key; </span><br><span class="line">	&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>文件下载：</p>
                  <figure class="highlight php">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="keyword">public</span> <span class="function"><span class="keyword">function</span> <span class="title">downloadPic</span><span class="params">()</span></span>&#123;</span><br><span class="line">		<span class="keyword">require_once</span>(dirname(<span class="keyword">__FILE__</span>).<span class="string">"/../../qiniu/rs.php"</span>);</span><br><span class="line">		$key = <span class="string">'00000'</span>;</span><br><span class="line">		$domain = <span class="string">'designpartners.qiniudn.com'</span>;</span><br><span class="line">		$accessKey = <span class="string">'IOImn35KC57Ov3scxbYkvNk6oIxB7zWsBRp16'</span>;</span><br><span class="line">		$secretKey = <span class="string">'s29vc9tlCvsh7QScYTuzCDmIbUSi4EroKj1z'</span>;</span><br><span class="line">		Qiniu_SetKeys($accessKey, $secretKey);  </span><br><span class="line">		$baseUrl = Qiniu_RS_MakeBaseUrl($domain, $key);</span><br><span class="line">		$getPolicy = <span class="keyword">new</span> Qiniu_RS_GetPolicy();</span><br><span class="line">		$privateUrl = $getPolicy-&gt;MakeRequest($baseUrl, <span class="keyword">null</span>);</span><br><span class="line">		<span class="keyword">echo</span> <span class="string">"====&gt; getPolicy result: \n"</span>;</span><br><span class="line">		<span class="keyword">echo</span> $privateUrl . <span class="string">"\n"</span>;</span><br><span class="line">	&#125;</span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>表单：</p>
                  <figure class="highlight xquery">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">script</span>&gt;</span></span></span><br><span class="line"><span class="xml">	function isValidateFile(obj) </span><span class="xquery">&#123;</span></span><br><span class="line"><span class="xquery">		var extend =<span class="built_in"> document</span>.form.file.<span class="keyword">value</span><span class="built_in">.substring</span><span class="built_in">(document</span>.form.file.<span class="keyword">value</span>.lastIndexOf(<span class="string">"."</span>) + <span class="number">1</span>);</span></span><br><span class="line"><span class="xquery">		<span class="keyword">if</span> (extend == <span class="string">""</span>) &#123;</span></span><br><span class="line"><span class="xquery">			alert(<span class="string">"请选择头像"</span>);</span></span><br><span class="line"><span class="xquery">			<span class="keyword">return</span><span class="built_in"> false</span>;</span></span><br><span class="line"><span class="xquery">		&#125;</span></span><br><span class="line"><span class="xml">		else </span><span class="xquery">&#123;</span></span><br><span class="line"><span class="xquery">			<span class="keyword">if</span> (!(extend == <span class="string">"jpg"</span> || extend == <span class="string">"png"</span>)) &#123;</span></span><br><span class="line"><span class="xquery">			alert(<span class="string">"请上传后缀名为jpg或png的文件!"</span>);</span></span><br><span class="line"><span class="xquery">			<span class="keyword">return</span><span class="built_in"> false</span>;</span></span><br><span class="line"><span class="xquery">			&#125;</span></span><br><span class="line"><span class="xml">		&#125;</span></span><br><span class="line"><span class="xml">		return true;</span></span><br><span class="line"><span class="xml">	&#125;</span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">script</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;<span class="name">form</span> <span class="attr">method</span>=<span class="string">"post"</span> <span class="attr">action</span>=<span class="string">"http://up.qiniu.com"</span> <span class="attr">name</span> = <span class="string">"form"</span> <span class="attr">enctype</span>=<span class="string">"multipart/form-data"</span> <span class="attr">onsubmit</span>=<span class="string">"return isValidateFile('file');"</span>&gt;</span></span></span><br><span class="line"><span class="xml">    </span><span class="xml"><span class="tag">&lt;<span class="name">ul</span>&gt;</span></span></span><br><span class="line"><span class="xml">            <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"hidden"</span>  <span class="attr">id</span>=<span class="string">"token"</span> <span class="attr">name</span>=<span class="string">"token"</span>  <span class="attr">value</span>=&lt;?<span class="attr">php</span> <span class="attr">echo</span> $<span class="attr">upToken</span>?&gt;</span>&gt;</span></span><br><span class="line"><span class="xml">        </span><span class="xml"><span class="tag">&lt;<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">            </span><span class="xml"><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">"key"</span>&gt;</span>key:<span class="tag">&lt;/<span class="name">label</span>&gt;</span></span></span><br><span class="line"><span class="xml">            </span><span class="xml"><span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">"key"</span> <span class="attr">value</span>=<span class="string">""</span>&gt;</span></span></span><br><span class="line"><span class="xml">        <span class="tag">&lt;/<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">        </span><span class="xml"><span class="tag">&lt;<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">            </span><span class="xml"><span class="tag">&lt;<span class="name">label</span> <span class="attr">for</span>=<span class="string">"bucket"</span>&gt;</span>照片:<span class="tag">&lt;/<span class="name">label</span>&gt;</span></span></span><br><span class="line"><span class="xml">            <span class="tag">&lt;<span class="name">input</span> <span class="attr">name</span>=<span class="string">"file"</span>  <span class="attr">type</span>=<span class="string">"file"</span> /&gt;</span></span></span><br><span class="line"><span class="xml">        <span class="tag">&lt;/<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">        </span><span class="xml"><span class="tag">&lt;<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">            <span class="tag">&lt;<span class="name">input</span> <span class="attr">type</span>=<span class="string">"submit"</span> <span class="attr">value</span>=<span class="string">"提交"</span> &gt;</span></span></span><br><span class="line"><span class="xml">        <span class="tag">&lt;/<span class="name">li</span>&gt;</span></span></span><br><span class="line"><span class="xml">    <span class="tag">&lt;/<span class="name">ul</span>&gt;</span></span></span><br><span class="line"><span class="xml"><span class="tag">&lt;/<span class="name">form</span>&gt;</span></span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-10-19 18:14:01" itemprop="dateCreated datePublished" datetime="2014-10-19T18:14:01+08:00">2014-10-19</time>
                </span>
                <span id="/157.html" class="post-meta-item leancloud_visitors" data-flag-title="PHP使用七牛云存储之图片的上传、下载、重定向教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>5.9k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>5 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/154.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> C/C++ <i class="label-arrow"></i>
                  </a>
                  <a href="/154.html" class="post-title-link" itemprop="url">Eclipse配置C/C++环境教程</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>本次为大家带来的是用Eclipse配置C/C++环境的具体步骤，希望对大家有帮助哦。 Eclipse 配置C/C++开发环境讲解如下： 1.JDK下载 如果没有安装JDK环境的小伙伴请自行去官网下载安装啦，安装之后的就可以跳过此步. 下载地址：<a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html" target="_blank" rel="noopener">JDK下载</a> <a href="http://jingyan.baidu.com/article/6dad5075d1dc40a123e36ea3.html" target="_blank" rel="noopener">JDK环境配置</a> 2.Eclipse下载 当然，下载JDK的目的是在Eclipse下先运行起Java程序，这样才能方便我们下一步的操作，没有Eclipse的也去下载。 下载地址： <a href="http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops/R-3.7-201106131736/eclipse-SDK-3.7-win32.zip" target="_blank" rel="noopener">Eclipse下载</a> 上面两步我想难度都很小，而且大部分同学已经配置了，我就不一一讲解了。 想了解详情，欢迎联系发我邮箱 1016903103@qq.com 3.CDT下载 CDT是什么？它就是Eclipse的一个插件，我们需要安装了之后才可以新建C/C++项目。 注意：下载的CDT必须和Eclipse的版本对应。 下载地址：<a href="http://www.eclipse.org/cdt/" target="_blank" rel="noopener">CDT下载</a> 上面下载的Eclipse是3.7版本，在此给出适配CDT 8.0的下载链接。 下载地址：<a href="http://www.eclipse.org/downloads/download.php?file=/tools/cdt/releases/indigo/dist/cdt-master-8.0.0.zip&amp;url=http://mirrors.ustc.edu.cn/eclipse/tools/cdt/releases/indigo/dist/cdt-master-8.0.0.zip&amp;mirror_id=1093" target="_blank" rel="noopener">CDT 8.0下载</a> 如果上述链接已失效，请自行百度适配你Eclipse版本的CDT进行下载。 下载之后它是一个压缩包zip格式。 不要解压直接安装即可，安装讲解如下： 打开Eclipse，进入菜单Help，选择Install New Software…，点击右边Add按钮，在Add Repository对话框中点击右下角的Archive…，浏览到你之前下载保存路径，选中cdt-master-8.0.0.zip并双击，勾选所有 CDT部件，然后点击Next&gt;，继续Next&gt;，选中“I accept the terms of the license agreement – Finish”，点击Finish开始安装CDT。 <img src="http://img.blog.csdn.net/20141003110738384?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 安装完CDT后重启Eclipse。 <img src="http://img.blog.csdn.net/20141003110647109?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 这样我们的Eclipse的CDT插件就安装好啦，这时你会发现可以新建C/C++项目了，但是还是不能编译运行，为什么？因为没有安装编译器。接下来我们需要下载mingw编译器。 4.mingw下载。 这是一个配套Eclipse的C/C++编译器，首先我们下载下来。 官网下载地址：<a href="http://sourceforge.net/projects/mingw/files/MinGW/" target="_blank" rel="noopener">mingw官网下载</a> 现在发现最新版本下载是：<a href="http://sourceforge.net/projects/mingw/files/latest/download?source=files" target="_blank" rel="noopener">mingw-get-setup.exe</a> 双击运行，选择安装路径，我的路径为：D:\mingw，安装完成之后你会发现出现一个下载库的窗口，叫Mingw Installation Manager 注意： 1. 我的类库已经安装完毕，所以每个类库前面都显示为绿色的方框，没安装之前是白色的，你需要都勾选上，然后下载安装。在每个类库上邮件单击选择make for installation即可勾选。再点击菜单中的Installation中的Update Catalogue即可安装你所勾选的类库了。 2. 安装下载可能花费不少时间，请耐心等待。 <img src="http://img.blog.csdn.net/20141003111834646?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 大家可以发现最左边有Basic Steup和All Packages两个分类。 第一个Basic Steup即为必须要安装的编译类库，All Packages即为所有的类库。为了保险起见，我把所有的类库都安装了。全部安装完之后即会显示绿色。 安装完之后的目录结构如下： <img src="http://img.blog.csdn.net/20141003112632413?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 5.配置 环境变量配置： 计算机– 属性 – 高级系统设置 – 环境变量 在上方的用户变量中进行如下操作： 注意：mingw的位置不同，环境变量的配置不同，可以看最底层目录比对着来配置。我的环境变量配置如下： （1）编辑PATH变量，在最后面加入 D:\mingw\bin D:\mingw\msys\1.0\bin D:\mingw\mingw32\bin （2）添加LIBRARY_PATH变量，内容为： D:\mingw\lib （3）添加C_INCLUDE_PATH变量，内容为： D:\mingw\include （4）添加CPLUS_INCLUDE_PATH变量，内容为： D:\mingw\lib\gcc\mingw32\4.8.1\include\c++ 修改： 进入D:\mingw\bin下将mingw32-make.exe复制成make.exe。因为Eclipse使用时预设是用系统里的”make”这个文件名，而不是”mingw32-make”。 Eclipse中的配置： 窗口 -&gt; 首选项 -&gt; C/C++ -&gt; New CDT Project Wizard 在右边的首选工具链的右边，工具链栏目内选择MinGW GCC，确定，如图所示： <img src="http://img.blog.csdn.net/20141003113658894?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 还是在原来的 New CDT Project Wizard选项卡中，展开，Makefile项目，二进制解析器，勾选PE windows解析器，确定，如图所示。 <img src="http://img.blog.csdn.net/20141003113807484?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 好啦，配置工作完成，我们来测试一下新C语言项目。 右键新建-&gt;项目-&gt;C项目 <img src="http://img.blog.csdn.net/20141003114106872?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 下一步，选择可执行文件，Hello World ANCI C Project 编译器选择 MinGw GCC 完成，如图所示： <img src="http://img.blog.csdn.net/20141003114126625?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 完成之后的界面应该是如下所示，点击构建项目，图中的红色圆圈，构建完成之后，右键运行程序 <img src="http://img.blog.csdn.net/20141003114748589?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> <img src="http://img.blog.csdn.net/20141003114637750?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 运行结果： <img src="http://img.blog.csdn.net/20141003115048145?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""> 欢呼吧小伙伴们 ! Eclipse 配置C/C++环境到此完全结束，如果有问题欢迎交流，欢迎评论交流。 我的邮箱：1016903103@qq.com 我的微博：<a href="http://weibo.com/u/2830678474" target="_blank" rel="noopener">新浪微博</a> <a href="http://t.qq.com/CQCcqc123456?preview" target="_blank" rel="noopener">腾讯微博</a></p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-10-19 18:06:57" itemprop="dateCreated datePublished" datetime="2014-10-19T18:06:57+08:00">2014-10-19</time>
                </span>
                <span id="/154.html" class="post-meta-item leancloud_visitors" data-flag-title="Eclipse配置C/C++环境教程" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>2.1k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>2 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/102.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> PHP <i class="label-arrow"></i>
                  </a>
                  <a href="/102.html" class="post-title-link" itemprop="url">在SAE上搭建WordPress网站之后的后续优化</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>在SAE上搭建自己的WordPress博客之后，接下来的工作会轻松比较多。还有一些细节上的处理问题在此做一下记录 1.绑定域名 首先，你必须有一个自己的域名，建议在国外网站注册域名，首先国外的域名不需要备案的，其实按常理来说是国外域名不需要备案，但是国内的一些机构规定了是国外主机才不需要备案。建议的网站有Godaddy、name、enom、Ipower、domainsite 不过就可能比国内网站贵.所以我在新网上注册的域名,不过比较坑的是它不支持二级域名绑定。 就比如说我想直接想用域名定位到121.250.211.33/wordpress 即直接用域名代替以上内容是办不到的。但是国外网站的支持这种功能。国内的应该也有，不过没有尝试过。 那么，有了域名之后，在sae上项目绑定域名选项，他会提示： 请 把e31549a6ef.cqcre.net通过A记录解析到178.19.181.223完成域名身份验证。 域名身份验证将在SAE获取到相关DNS记录后完成（由于各地DNS Cache的影响，此过程可能需要较长时间，但一般情况下在您解析完验证域名后一天之内能完成验证）。 那么在你的DNS服务器上设置A记录和CNAME记录就好了。 2.SEO优化 超强插件 all in one seo 下载地址：<a href="http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip" target="_blank" rel="noopener">http://downloads.wordpress.org/plugin/all-in-one-seo-pack.zip</a></p>
                  <p>做完网站怎么能不加seo优化呢？按完插件之后就设置主页标题、关键字、文章标题seo title 等等的东西咯。另外还有各种复杂的功能就不一一赘述了，seo优化还需要你做很多动作的。要不然怎么有人整天花那么多时间做seo优化呢？</p>
                  <p>3.访问之后又跳回sinaapp二级域名的解决 这个可能遇到的问题是点击一篇文章之后，又跳转到sinaapp上去了。 这是因为没有修改wordpress的url配置的缘故，只需要登录wordpress后台，在“设置-常规”里将“WordPress 地址（URL）”和“站点地址（URL）”两项修改为新域名即可。注意必须修改同时修改这两个，要不然可能还是出现同样的问题。 另外需要注意的是，这样设置之后，每次都要重新进行解析，而且走的是国外DNS线路，会耗费双倍的云豆。如果你的域名已经备案的话那么就会走国内线路了，而且速度快，云豆耗费还是原量。总是备案的好处还是多多的。 4.不备案域名提高访问速度 由于sae是通过中转境外的代理服务器来实现绑定未备案的独立域名的，访问速度会慢于直接通过二级域名访问。从网上发现这么一个插件能够实现“将资源文件通过SAE二级域名进行访问，而将网站主要文件通过主域名访问，进而加快访问速度”，理论上应该是会有些许效果的，不过没有对比测试过。 链接地址：<a href="http://www.219.me/posts/964" target="_blank" rel="noopener">http://www.219.me/posts/964</a> 5.让二级域名重新定位到顶级域名 使用新域名前创建的页面可能已经被搜索引擎收录，如果希望通过这些链接访问网站时能自动跳转至新域名的话，就需要通过配置让这部分链接301永久重定向至新域名。通常是通过修改apache的.htaccess配置文件来实现url的重定向，但是sae并不支持.htaccess的配置，而是使用了自己的AppConfig配置来实现，修改wordpress根目录下的config.yaml文件即可达到效果，使用如下： 添加如下代码即可：</p>
                  <figure class="highlight lua">
                    <table>
                      <tr>
                        <td class="gutter">
                          <pre><span class="line">1</span><br><span class="line">2</span><br></pre>
                        </td>
                        <td class="code">
                          <pre><span class="line">- rewrite: <span class="keyword">if</span>(in_header[<span class="string">"host"</span>] ~ <span class="string">"^abc.sinaapp.com"</span> &amp;&amp; </span><br><span class="line"><span class="built_in">path</span> ~ <span class="string">"^(.*)$"</span>) <span class="keyword">goto</span> <span class="string">"www.cqcre.net$1 [L,QSA,R=301]"</span></span><br></pre>
                        </td>
                      </tr>
                    </table>
                  </figure>
                  <p>其中 abc.sinaapp.com 即为原网址，www.cqcre.net即为跳转到的网址。可以根据自己的需要进行替换 6.手机端访问出现混乱的问题 大家访问之后可能出现用手机访问之后布局变得混乱，或者字体太小。因为我们本身建的站点就是为电脑或者平板访问的，所以用我们手机这种小屏幕来访问的话可能就会出现问题。 解决办法：单独加一个手机端专用主题，比如我的网站用手机和电脑访问呈现的主题是不一样的，可以尝试一下哦。 其实大家找个手机主题可以改成相仿的风格就好啦。不过如果有直接支持电脑和手机同时访问的主题那就不用咯。 在此推荐两款手机主题，大家可以在此基础上进行修改。Mobile-better 和 Mobile pack 两款都是非常简洁的主题，可扩展性较强。 另外还需要安装一个插件：Any Mobile Theme Switcher,在设置界面可以选择自己显示的主题。有好多选项，比如Android端访问的是什么主题，ipad 端访问的是什么主题，其他等等访问用的是什么主题。设置好之后，就尝试下吧。 以上是我总结的对sae上的WordPress站点的优化，欢迎大家讨论分享。</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-09-13 00:16:49" itemprop="dateCreated datePublished" datetime="2014-09-13T00:16:49+08:00">2014-09-13</time>
                </span>
                <span id="/102.html" class="post-meta-item leancloud_visitors" data-flag-title="在SAE上搭建WordPress网站之后的后续优化" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>2k</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>2 分钟</span>
                </span>
              </div>
            </article>
            <article itemscope itemtype="http://schema.org/Article" class="post-block index" lang="zh-CN">
              <link itemprop="mainEntityOfPage" href="https://cuiqingcai.com/37.html">
              <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
                <meta itemprop="image" content="/images/avatar.png">
                <meta itemprop="name" content="崔庆才">
                <meta itemprop="description" content="崔庆才的个人站点，记录生活的瞬间，分享学习的心得。">
              </span>
              <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
                <meta itemprop="name" content="静觅">
              </span>
              <header class="post-header">
                <h2 class="post-title" itemprop="name headline">
                  <a class="label"> Other <i class="label-arrow"></i>
                  </a>
                  <a href="/37.html" class="post-title-link" itemprop="url">JSP在tomcat服务器下无法连接MySql问题解决方法</a>
                </h2>
              </header>
              <div class="post-body" itemprop="articleBody">
                <div class="thumb">
                  <img itemprop="contentUrl" class="random">
                </div>
                <div class="excerpt">
                  <p>
                  <p>我连的是MySQL数据库，但是在服务器下运行jsp文件时会出现如下的状况：</p>
                  <p>控制台报错：com.mysql.jdbc.Driver</p>
                  <p>即不能找到驱动程序，通过我的一次次试验，终于得到解决</p>
                  <p>首先我的代码编写是没有问题的，而且我已经在eclipse下的jar库中导入了jdbc驱动文件。直接运行java应用程序</p>
                  <p><img src="http://img.blog.csdn.net/20140309212942125?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p>运行java应用程序，结果如图所示，成功连接上数据库并打印输出了teacher表中所有数据。</p>
                  <p><img src="http://img.blog.csdn.net/20140309214422546?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p>jsp中的代码如图所示：即引用了该java文件并打印输出</p>
                  <p><img src="http://img.blog.csdn.net/20140309214703328?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p>但是通过tomcat运行程序，控制台报错：com.mysql.jdbc.Driver</p>
                  <p>可以说明没有找到该驱动程序，说明我们放在改project下的驱动程序是没有应用上的。</p>
                  <p>内部原理是：jsp文件先转化成java文件，再编译成class文件在tomcat下执行，所以调用的驱动程序应该置于tomcat根目录下。然后</p>
                  <p>我把这个jdbc驱动程序放在了tomcat的lib目录下，再次运行。</p>
                  <p>继续报错：com.mysql.jdbc.Driver</p>
                  <p>仍然没有找到驱动程序，最后发现是忘记了配置环境变量，这个很重要。</p>
                  <p>打开环境变量配置页面，在CLASSPATH中，加入</p>
                  <p>D:tomcat 6.0apache-tomcat-6.0.29libmysql-connector-java-5.0.8-bin.jar</p>
                  <p>注:读者路径不一定和我一样，我把tomcat放在了D盘</p>
                  <p>如图：</p>
                  <p><img src="http://img.blog.csdn.net/20140309215249828?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p>接下来运行，测试</p>
                  <p>成功！！没有报错，运行结果如图：</p>
                  <p><img src="http://img.blog.csdn.net/20140309215907765?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p><img src="http://img.blog.csdn.net/20140309220045421?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvY3FjcmU=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast" alt=""></p>
                  <p>成功解决！有问题的可以评论，看到后我会及时回复的！希望对大家有帮助！</p>
                  </p>
                </div>
              </div>
              <div class="post-meta">
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-user"></i>
                  </span>
                  <span class="post-meta-item-text">作者</span>
                  <span><a href="/authors/崔庆才" class="author" itemprop="url" rel="index">崔庆才</a></span>
                </span>
                <span class="post-meta-item">
                  <span class="post-meta-item-icon">
                    <i class="far fa-calendar"></i>
                  </span>
                  <span class="post-meta-item-text">发表于</span>
                  <time title="创建时间：2014-09-10 13:22:31" itemprop="dateCreated datePublished" datetime="2014-09-10T13:22:31+08:00">2014-09-10</time>
                </span>
                <span id="/37.html" class="post-meta-item leancloud_visitors" data-flag-title="JSP在tomcat服务器下无法连接MySql问题解决方法" title="阅读次数">
                  <span class="post-meta-item-icon">
                    <i class="fa fa-eye"></i>
                  </span>
                  <span class="post-meta-item-text">阅读次数：</span>
                  <span class="leancloud-visitors-count"></span>
                </span>
                <span class="post-meta-item" title="本文字数">
                  <span class="post-meta-item-icon">
                    <i class="far fa-file-word"></i>
                  </span>
                  <span class="post-meta-item-text">本文字数：</span>
                  <span>650</span>
                </span>
                <span class="post-meta-item" title="阅读时长">
                  <span class="post-meta-item-icon">
                    <i class="far fa-clock"></i>
                  </span>
                  <span class="post-meta-item-text">阅读时长 &asymp;</span>
                  <span>1 分钟</span>
                </span>
              </div>
            </article>
            <script>
              document.querySelectorAll('.random').forEach(item => item.src = "https://picsum.photos/id/" + Math.floor(Math.random() * Math.floor(300)) + "/200/133")

            </script>
            <nav class="pagination">
              <a class="extend prev" rel="prev" href="/page/29/"><i class="fa fa-angle-left" aria-label="上一页"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/29/">29</a><span class="page-number current">30</span><a class="page-number" href="/page/31/">31</a><a class="extend next" rel="next" href="/page/31/"><i class="fa fa-angle-right" aria-label="下一页"></i></a>
            </nav>
          </div>
          <script>
            window.addEventListener('tabs:register', () =>
            {
              let
              {
                activeClass
              } = CONFIG.comments;
              if (CONFIG.comments.storage)
              {
                activeClass = localStorage.getItem('comments_active') || activeClass;
              }
              if (activeClass)
              {
                let activeTab = document.querySelector(`a[href="#comment-${activeClass}"]`);
                if (activeTab)
                {
                  activeTab.click();
                }
              }
            });
            if (CONFIG.comments.storage)
            {
              window.addEventListener('tabs:click', event =>
              {
                if (!event.target.matches('.tabs-comment .tab-content .tab-pane')) return;
                let commentClass = event.target.classList[1];
                localStorage.setItem('comments_active', commentClass);
              });
            }

          </script>
        </div>
        <div class="toggle sidebar-toggle">
          <span class="toggle-line toggle-line-first"></span>
          <span class="toggle-line toggle-line-middle"></span>
          <span class="toggle-line toggle-line-last"></span>
        </div>
        <aside class="sidebar">
          <div class="sidebar-inner">
            <ul class="sidebar-nav motion-element">
              <li class="sidebar-nav-toc"> 文章目录 </li>
              <li class="sidebar-nav-overview"> 站点概览 </li>
            </ul>
            <!--noindex-->
            <div class="post-toc-wrap sidebar-panel">
            </div>
            <!--/noindex-->
            <div class="site-overview-wrap sidebar-panel">
              <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
                <img class="site-author-image" itemprop="image" alt="崔庆才" src="/images/avatar.png">
                <p class="site-author-name" itemprop="name">崔庆才</p>
                <div class="site-description" itemprop="description">崔庆才的个人站点，记录生活的瞬间，分享学习的心得。</div>
              </div>
              <div class="site-state-wrap motion-element">
                <nav class="site-state">
                  <div class="site-state-item site-state-posts">
                    <a href="/archives/">
                      <span class="site-state-item-count">608</span>
                      <span class="site-state-item-name">日志</span>
                    </a>
                  </div>
                  <div class="site-state-item site-state-categories">
                    <a href="/categories/">
                      <span class="site-state-item-count">24</span>
                      <span class="site-state-item-name">分类</span></a>
                  </div>
                  <div class="site-state-item site-state-tags">
                    <a href="/tags/">
                      <span class="site-state-item-count">156</span>
                      <span class="site-state-item-name">标签</span></a>
                  </div>
                </nav>
              </div>
              <div class="links-of-author motion-element">
                <span class="links-of-author-item">
                  <a href="https://github.com/Germey" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;Germey" rel="noopener" target="_blank"><i class="fab fa-github fa-fw"></i>GitHub</a>
                </span>
                <span class="links-of-author-item">
                  <a href="mailto:cqc@cuiqingcai.com.com" title="邮件 → mailto:cqc@cuiqingcai.com.com" rel="noopener" target="_blank"><i class="fa fa-envelope fa-fw"></i>邮件</a>
                </span>
                <span class="links-of-author-item">
                  <a href="https://weibo.com/cuiqingcai" title="微博 → https:&#x2F;&#x2F;weibo.com&#x2F;cuiqingcai" rel="noopener" target="_blank"><i class="fab fa-weibo fa-fw"></i>微博</a>
                </span>
                <span class="links-of-author-item">
                  <a href="https://www.zhihu.com/people/Germey" title="知乎 → https:&#x2F;&#x2F;www.zhihu.com&#x2F;people&#x2F;Germey" rel="noopener" target="_blank"><i class="fa fa-magic fa-fw"></i>知乎</a>
                </span>
              </div>
            </div>
            <div style=" width: 100%;" class="sidebar-panel sidebar-panel-image sidebar-panel-active">
              <a href="https://tutorial.lengyue.video/?coupon=12ef4b1a-a3db-11ea-bb37-0242ac130002_cqx_850" target="_blank" rel="noopener">
                <img src="https://qiniu.cuiqingcai.com/bco2a.png" style=" width: 100%;">
              </a>
            </div>
            <div style=" width: 100%;" class="sidebar-panel sidebar-panel-image sidebar-panel-active">
              <a href="http://www.ipidea.net/?utm-source=cqc&utm-keyword=?cqc" target="_blank" rel="noopener">
                <img src="https://qiniu.cuiqingcai.com/0ywun.png" style=" width: 100%;">
              </a>
            </div>
            <div class="sidebar-panel sidebar-panel-tags sidebar-panel-active">
              <h4 class="name"> 标签云 </h4>
              <div class="content">
                <a href="/tags/2048/" style="font-size: 10px;">2048</a> <a href="/tags/API/" style="font-size: 10px;">API</a> <a href="/tags/Bootstrap/" style="font-size: 11.25px;">Bootstrap</a> <a href="/tags/CDN/" style="font-size: 10px;">CDN</a> <a href="/tags/CQC/" style="font-size: 10px;">CQC</a> <a href="/tags/CSS/" style="font-size: 10px;">CSS</a> <a href="/tags/CSS-%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 10px;">CSS 反爬虫</a> <a href="/tags/CV/" style="font-size: 10px;">CV</a> <a href="/tags/Django/" style="font-size: 10px;">Django</a> <a href="/tags/Eclipse/" style="font-size: 11.25px;">Eclipse</a> <a href="/tags/FTP/" style="font-size: 10px;">FTP</a> <a href="/tags/Git/" style="font-size: 10px;">Git</a> <a href="/tags/GitHub/" style="font-size: 13.75px;">GitHub</a> <a href="/tags/HTML5/" style="font-size: 10px;">HTML5</a> <a href="/tags/Hexo/" style="font-size: 10px;">Hexo</a> <a href="/tags/IT/" style="font-size: 10px;">IT</a> <a href="/tags/JSP/" style="font-size: 10px;">JSP</a> <a href="/tags/JavaScript/" style="font-size: 10px;">JavaScript</a> <a href="/tags/K8s/" style="font-size: 10px;">K8s</a> <a href="/tags/LOGO/" style="font-size: 10px;">LOGO</a> <a href="/tags/Linux/" style="font-size: 10px;">Linux</a> <a href="/tags/MIUI/" style="font-size: 10px;">MIUI</a> <a href="/tags/MongoDB/" style="font-size: 10px;">MongoDB</a> <a href="/tags/Mysql/" style="font-size: 10px;">Mysql</a> <a href="/tags/NBA/" style="font-size: 10px;">NBA</a> <a href="/tags/PHP/" style="font-size: 11.25px;">PHP</a> <a href="/tags/PS/" style="font-size: 10px;">PS</a> <a href="/tags/Pathlib/" style="font-size: 10px;">Pathlib</a> <a href="/tags/PhantomJS/" style="font-size: 10px;">PhantomJS</a> <a href="/tags/Python/" style="font-size: 15px;">Python</a> <a href="/tags/Python3/" style="font-size: 12.5px;">Python3</a> <a href="/tags/Pythonic/" style="font-size: 10px;">Pythonic</a> <a href="/tags/QQ/" style="font-size: 10px;">QQ</a> <a href="/tags/Redis/" style="font-size: 10px;">Redis</a> <a href="/tags/SAE/" style="font-size: 10px;">SAE</a> <a href="/tags/SSH/" style="font-size: 10px;">SSH</a> <a href="/tags/SVG/" style="font-size: 10px;">SVG</a> <a href="/tags/Scrapy/" style="font-size: 10px;">Scrapy</a> <a href="/tags/Scrapy-redis/" style="font-size: 10px;">Scrapy-redis</a> <a href="/tags/Scrapy%E5%88%86%E5%B8%83%E5%BC%8F/" style="font-size: 10px;">Scrapy分布式</a> <a href="/tags/Selenium/" style="font-size: 10px;">Selenium</a> <a href="/tags/TKE/" style="font-size: 10px;">TKE</a> <a href="/tags/Ubuntu/" style="font-size: 11.25px;">Ubuntu</a> <a href="/tags/VS-Code/" style="font-size: 10px;">VS Code</a> <a href="/tags/Vs-Code/" style="font-size: 10px;">Vs Code</a> <a href="/tags/Vue/" style="font-size: 11.25px;">Vue</a> <a href="/tags/Webpack/" style="font-size: 10px;">Webpack</a> <a href="/tags/Windows/" style="font-size: 10px;">Windows</a> <a href="/tags/Winpcap/" style="font-size: 10px;">Winpcap</a> <a href="/tags/WordPress/" style="font-size: 13.75px;">WordPress</a> <a href="/tags/Youtube/" style="font-size: 11.25px;">Youtube</a> <a href="/tags/android/" style="font-size: 10px;">android</a> <a href="/tags/ansible/" style="font-size: 10px;">ansible</a> <a href="/tags/cocos2d-x/" style="font-size: 10px;">cocos2d-x</a> <a href="/tags/e6/" style="font-size: 10px;">e6</a> <a href="/tags/fitvids/" style="font-size: 10px;">fitvids</a> <a href="/tags/git/" style="font-size: 11.25px;">git</a> <a href="/tags/json/" style="font-size: 10px;">json</a> <a href="/tags/js%E9%80%86%E5%90%91/" style="font-size: 10px;">js逆向</a> <a href="/tags/kubernetes/" style="font-size: 10px;">kubernetes</a> <a href="/tags/log/" style="font-size: 10px;">log</a> <a href="/tags/logging/" style="font-size: 10px;">logging</a> <a href="/tags/matlab/" style="font-size: 11.25px;">matlab</a> <a href="/tags/python/" style="font-size: 20px;">python</a> <a href="/tags/pytube/" style="font-size: 11.25px;">pytube</a> <a href="/tags/pywin32/" style="font-size: 10px;">pywin32</a> <a href="/tags/style/" style="font-size: 10px;">style</a> <a href="/tags/tomcat/" style="font-size: 10px;">tomcat</a> <a href="/tags/ubuntu/" style="font-size: 10px;">ubuntu</a> <a href="/tags/uwsgi/" style="font-size: 10px;">uwsgi</a> <a href="/tags/vsftpd/" style="font-size: 10px;">vsftpd</a> <a href="/tags/wamp/" style="font-size: 10px;">wamp</a> <a href="/tags/wineQQ/" style="font-size: 10px;">wineQQ</a> <a href="/tags/%E4%B8%83%E7%89%9B/" style="font-size: 11.25px;">七牛</a> <a href="/tags/%E4%B8%8A%E6%B5%B7/" style="font-size: 10px;">上海</a> <a href="/tags/%E4%B8%AA%E4%BA%BA%E7%BD%91%E7%AB%99/" style="font-size: 10px;">个人网站</a> <a href="/tags/%E4%B8%BB%E9%A2%98/" style="font-size: 10px;">主题</a> <a href="/tags/%E4%BA%91%E4%BA%A7%E5%93%81/" style="font-size: 10px;">云产品</a> <a href="/tags/%E4%BA%91%E5%AD%98%E5%82%A8/" style="font-size: 10px;">云存储</a> <a href="/tags/%E4%BA%AC%E4%B8%9C%E4%BA%91/" style="font-size: 10px;">京东云</a> <a href="/tags/%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD/" style="font-size: 12.5px;">人工智能</a> <a href="/tags/%E4%BB%A3%E7%90%86/" style="font-size: 10px;">代理</a> <a href="/tags/%E4%BB%A3%E7%A0%81/" style="font-size: 10px;">代码</a> <a href="/tags/%E4%BB%A3%E7%A0%81%E5%88%86%E4%BA%AB%E5%9B%BE/" style="font-size: 10px;">代码分享图</a> <a href="/tags/%E4%BC%98%E5%8C%96/" style="font-size: 10px;">优化</a> <a href="/tags/%E4%BD%8D%E8%BF%90%E7%AE%97/" style="font-size: 10px;">位运算</a> <a href="/tags/%E5%85%AC%E4%BC%97%E5%8F%B7/" style="font-size: 10px;">公众号</a> <a href="/tags/%E5%88%86%E4%BA%AB/" style="font-size: 10px;">分享</a> <a href="/tags/%E5%88%86%E5%B8%83%E5%BC%8F/" style="font-size: 10px;">分布式</a> <a href="/tags/%E5%88%9B%E4%B8%9A/" style="font-size: 10px;">创业</a> <a href="/tags/%E5%89%8D%E7%AB%AF/" style="font-size: 12.5px;">前端</a> <a href="/tags/%E5%8D%9A%E5%AE%A2/" style="font-size: 10px;">博客</a> <a href="/tags/%E5%8E%9F%E7%94%9FAPP/" style="font-size: 10px;">原生APP</a> <a href="/tags/%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 12.5px;">反爬虫</a> <a href="/tags/%E5%91%BD%E4%BB%A4/" style="font-size: 10px;">命令</a> <a href="/tags/%E5%93%8D%E5%BA%94%E5%BC%8F%E5%B8%83%E5%B1%80/" style="font-size: 10px;">响应式布局</a> <a href="/tags/%E5%9E%83%E5%9C%BE%E9%82%AE%E4%BB%B6/" style="font-size: 10px;">垃圾邮件</a> <a href="/tags/%E5%9F%9F%E5%90%8D%E7%BB%91%E5%AE%9A/" style="font-size: 10px;">域名绑定</a> <a href="/tags/%E5%A4%8D%E7%9B%98/" style="font-size: 10px;">复盘</a> <a href="/tags/%E5%A4%A7%E4%BC%97%E7%82%B9%E8%AF%84/" style="font-size: 10px;">大众点评</a> <a href="/tags/%E5%AD%97%E4%BD%93%E5%8F%8D%E7%88%AC%E8%99%AB/" style="font-size: 10px;">字体反爬虫</a> <a href="/tags/%E5%AD%97%E7%AC%A6%E9%97%AE%E9%A2%98/" style="font-size: 10px;">字符问题</a> <a href="/tags/%E5%AD%A6%E4%B9%A0%E6%96%B9%E6%B3%95/" style="font-size: 10px;">学习方法</a> <a href="/tags/%E5%AE%89%E5%8D%93/" style="font-size: 10px;">安卓</a> <a href="/tags/%E5%AE%9E%E7%94%A8/" style="font-size: 10px;">实用</a> <a href="/tags/%E5%B0%81%E9%9D%A2/" style="font-size: 10px;">封面</a> <a href="/tags/%E5%B4%94%E5%BA%86%E6%89%8D/" style="font-size: 18.75px;">崔庆才</a> <a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 12.5px;">工具</a> <a href="/tags/%E5%BC%80%E5%8F%91%E5%B7%A5%E5%85%B7/" style="font-size: 10px;">开发工具</a> <a href="/tags/%E5%BE%AE%E8%BD%AF/" style="font-size: 10px;">微软</a> <a href="/tags/%E6%80%9D%E8%80%83/" style="font-size: 10px;">思考</a> <a href="/tags/%E6%89%8B%E6%9C%BA%E8%AE%BF%E9%97%AE/" style="font-size: 10px;">手机访问</a> <a href="/tags/%E6%95%99%E7%A8%8B/" style="font-size: 10px;">教程</a> <a href="/tags/%E6%95%99%E8%82%B2/" style="font-size: 10px;">教育</a> <a href="/tags/%E6%96%B0%E4%B9%A6/" style="font-size: 12.5px;">新书</a> <a href="/tags/%E6%96%B9%E6%B3%95%E8%AE%BA/" style="font-size: 10px;">方法论</a> <a href="/tags/%E6%97%85%E6%B8%B8/" style="font-size: 10px;">旅游</a> <a href="/tags/%E6%97%A5%E5%BF%97/" style="font-size: 10px;">日志</a> <a href="/tags/%E6%9A%97%E6%97%B6%E9%97%B4/" style="font-size: 10px;">暗时间</a> <a href="/tags/%E6%9D%9C%E5%85%B0%E7%89%B9/" style="font-size: 11.25px;">杜兰特</a> <a href="/tags/%E6%A1%8C%E9%9D%A2/" style="font-size: 10px;">桌面</a> <a href="/tags/%E6%AD%8C%E5%8D%95/" style="font-size: 10px;">歌单</a> <a href="/tags/%E6%B1%9F%E5%8D%97/" style="font-size: 10px;">江南</a> <a href="/tags/%E6%B8%B8%E6%88%8F/" style="font-size: 10px;">游戏</a> <a href="/tags/%E7%84%A6%E8%99%91/" style="font-size: 10px;">焦虑</a> <a href="/tags/%E7%88%AC%E8%99%AB/" style="font-size: 16.25px;">爬虫</a> <a href="/tags/%E7%88%AC%E8%99%AB%E4%B9%A6%E7%B1%8D/" style="font-size: 11.25px;">爬虫书籍</a> <a href="/tags/%E7%8E%AF%E5%A2%83%E5%8F%98%E9%87%8F/" style="font-size: 10px;">环境变量</a> <a href="/tags/%E7%94%9F%E6%B4%BB%E7%AC%94%E8%AE%B0/" style="font-size: 10px;">生活笔记</a> <a href="/tags/%E7%99%BB%E5%BD%95/" style="font-size: 10px;">登录</a> <a href="/tags/%E7%9F%A5%E4%B9%8E/" style="font-size: 10px;">知乎</a> <a href="/tags/%E7%9F%AD%E4%BF%A1/" style="font-size: 10px;">短信</a> <a href="/tags/%E7%9F%AD%E4%BF%A1%E9%AA%8C%E8%AF%81%E7%A0%81/" style="font-size: 10px;">短信验证码</a> <a href="/tags/%E7%AC%94%E8%AE%B0%E8%BD%AF%E4%BB%B6/" style="font-size: 10px;">笔记软件</a> <a href="/tags/%E7%AF%AE%E7%BD%91/" style="font-size: 10px;">篮网</a> <a href="/tags/%E7%BA%B8%E5%BC%A0/" style="font-size: 10px;">纸张</a> <a href="/tags/%E7%BB%84%E4%BB%B6/" style="font-size: 10px;">组件</a> <a href="/tags/%E7%BD%91%E7%AB%99/" style="font-size: 10px;">网站</a> <a href="/tags/%E7%BD%91%E7%BB%9C%E7%88%AC%E8%99%AB/" style="font-size: 11.25px;">网络爬虫</a> <a href="/tags/%E7%BE%8E%E5%AD%A6/" style="font-size: 10px;">美学</a> <a href="/tags/%E8%82%89%E5%A4%B9%E9%A6%8D/" style="font-size: 10px;">肉夹馍</a> <a href="/tags/%E8%85%BE%E8%AE%AF%E4%BA%91/" style="font-size: 10px;">腾讯云</a> <a href="/tags/%E8%87%AA%E5%BE%8B/" style="font-size: 10px;">自律</a> <a href="/tags/%E8%A5%BF%E5%B0%91%E7%88%B7/" style="font-size: 10px;">西少爷</a> <a href="/tags/%E8%A7%86%E9%A2%91/" style="font-size: 10px;">视频</a> <a href="/tags/%E8%B0%B7%E6%AD%8C%E9%AA%8C%E8%AF%81%E7%A0%81/" style="font-size: 10px;">谷歌验证码</a> <a href="/tags/%E8%BF%90%E8%90%A5/" style="font-size: 10px;">运营</a> <a href="/tags/%E8%BF%9C%E7%A8%8B/" style="font-size: 10px;">远程</a> <a href="/tags/%E9%80%86%E5%90%91/" style="font-size: 10px;">逆向</a> <a href="/tags/%E9%85%8D%E7%BD%AE/" style="font-size: 10px;">配置</a> <a href="/tags/%E9%87%8D%E8%A3%85/" style="font-size: 10px;">重装</a> <a href="/tags/%E9%98%BF%E6%9D%9C/" style="font-size: 10px;">阿杜</a> <a href="/tags/%E9%9D%99%E8%A7%85/" style="font-size: 17.5px;">静觅</a> <a href="/tags/%E9%A2%A0%E8%A6%86/" style="font-size: 10px;">颠覆</a> <a href="/tags/%E9%A3%9E%E4%BF%A1/" style="font-size: 10px;">飞信</a> <a href="/tags/%E9%B8%BF%E8%92%99/" style="font-size: 10px;">鸿蒙</a>
              </div>
              <script>
                const tagsColors = ['#00a67c', '#5cb85c', '#d9534f', '#567e95', '#b37333', '#f4843d', '#15a287']
                const tagsElements = document.querySelectorAll('.sidebar-panel-tags .content a')
                tagsElements.forEach((item) =>
                {
                  item.style.backgroundColor = tagsColors[Math.floor(Math.random() * tagsColors.length)]
                })

              </script>
            </div>
            <div class="sidebar-panel sidebar-panel-categories sidebar-panel-active">
              <h4 class="name"> 分类 </h4>
              <div class="content">
                <ul class="category-list">
                  <li class="category-list-item"><a class="category-list-link" href="/categories/C-C/">C/C++</a><span class="category-list-count">23</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/HTML/">HTML</a><span class="category-list-count">14</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Java/">Java</a><span class="category-list-count">5</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/JavaScript/">JavaScript</a><span class="category-list-count">26</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Linux/">Linux</a><span class="category-list-count">15</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Markdown/">Markdown</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Net/">Net</a><span class="category-list-count">4</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Other/">Other</a><span class="category-list-count">39</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/PHP/">PHP</a><span class="category-list-count">27</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Paper/">Paper</a><span class="category-list-count">2</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/Python/">Python</a><span class="category-list-count">261</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/TypeScript/">TypeScript</a><span class="category-list-count">2</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E5%B1%95%E7%A4%BA/">个人展示</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E6%97%A5%E8%AE%B0/">个人日记</a><span class="category-list-count">9</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E8%AE%B0%E5%BD%95/">个人记录</a><span class="category-list-count">4</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E4%B8%AA%E4%BA%BA%E9%9A%8F%E7%AC%94/">个人随笔</a><span class="category-list-count">15</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/">安装配置</a><span class="category-list-count">59</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E6%8A%80%E6%9C%AF%E6%9D%82%E8%B0%88/">技术杂谈</a><span class="category-list-count">88</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E6%9C%AA%E5%88%86%E7%B1%BB/">未分类</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E7%94%9F%E6%B4%BB%E7%AC%94%E8%AE%B0/">生活笔记</a><span class="category-list-count">1</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E7%A6%8F%E5%88%A9%E4%B8%93%E5%8C%BA/">福利专区</a><span class="category-list-count">6</span></li>
                  <li class="category-list-item"><a class="category-list-link" href="/categories/%E8%81%8C%E4%BD%8D%E6%8E%A8%E8%8D%90/">职位推荐</a><span class="category-list-count">2</span></li>
                </ul>
              </div>
            </div>
            <div class="sidebar-panel sidebar-panel-friends sidebar-panel-active">
              <h4 class="name"> 友情链接 </h4>
              <ul class="friends">
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/j2dub.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.findhao.net/" target="_blank" rel="noopener">FindHao</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ou6mm.jpg">
                  </span>
                  <span class="link">
                    <a href="https://diygod.me/" target="_blank" rel="noopener">DIYgod</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/6apxu.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.51dev.com/" target="_blank" rel="noopener">IT技术社区</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.jankl.com/img/titleshu.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.jankl.com/" target="_blank" rel="noopener">liberalist</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/bqlbs.png">
                  </span>
                  <span class="link">
                    <a href="http://www.urselect.com/" target="_blank" rel="noopener">优社电商</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/8s88c.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.yuanrenxue.com/" target="_blank" rel="noopener">猿人学</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/2wgg5.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.yunlifang.cn/" target="_blank" rel="noopener">云立方</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/shwr6.png">
                  </span>
                  <span class="link">
                    <a href="http://lanbing510.info/" target="_blank" rel="noopener">冰蓝</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/blvoh.jpg">
                  </span>
                  <span class="link">
                    <a href="https://lengyue.me/" target="_blank" rel="noopener">冷月</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="http://qianxunclub.com/favicon.png">
                  </span>
                  <span class="link">
                    <a href="http://qianxunclub.com/" target="_blank" rel="noopener">千寻啊千寻</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/0044u.jpg">
                  </span>
                  <span class="link">
                    <a href="http://kodcloud.com/" target="_blank" rel="noopener">可道云</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ygnpn.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.kunkundashen.cn/" target="_blank" rel="noopener">坤坤大神</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/22uv1.png">
                  </span>
                  <span class="link">
                    <a href="http://www.cenchong.com/" target="_blank" rel="noopener">岑冲博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ev9kl.png">
                  </span>
                  <span class="link">
                    <a href="http://www.zxiaoji.com/" target="_blank" rel="noopener">张小鸡</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.503error.com/favicon.ico">
                  </span>
                  <span class="link">
                    <a href="https://www.503error.com/" target="_blank" rel="noopener">张志明个人博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/x714o.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.hubwiz.com/" target="_blank" rel="noopener">汇智网</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/129d8.png">
                  </span>
                  <span class="link">
                    <a href="https://www.bysocket.com/" target="_blank" rel="noopener">泥瓦匠BYSocket</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://www.xiongge.club/favicon.ico">
                  </span>
                  <span class="link">
                    <a href="https://www.xiongge.club/" target="_blank" rel="noopener">熊哥club</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/3w4fe.png">
                  </span>
                  <span class="link">
                    <a href="https://zerlong.com/" target="_blank" rel="noopener">知语</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/44hxf.png">
                  </span>
                  <span class="link">
                    <a href="http://redstonewill.com/" target="_blank" rel="noopener">红色石头</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/8g1fk.jpg">
                  </span>
                  <span class="link">
                    <a href="http://www.laodong.me/" target="_blank" rel="noopener">老董博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/wkaus.jpg">
                  </span>
                  <span class="link">
                    <a href="https://zhaoshuai.me/" target="_blank" rel="noopener">碎念</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/pgo0r.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.chenwenguan.com/" target="_blank" rel="noopener">陈文管的博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/kk82a.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.lxlinux.net/" target="_blank" rel="noopener">良许Linux教程网</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/lj0t2.jpg">
                  </span>
                  <span class="link">
                    <a href="https://tanqingbo.cn/" target="_blank" rel="noopener">IT码农</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/i8cdr.png">
                  </span>
                  <span class="link">
                    <a href="https://junyiseo.com/" target="_blank" rel="noopener">均益个人博客</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/chwv2.png">
                  </span>
                  <span class="link">
                    <a href="https://brucedone.com/" target="_blank" rel="noopener">大鱼的鱼塘</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/2y43o.png">
                  </span>
                  <span class="link">
                    <a href="http://bbs.nightteam.cn/" target="_blank" rel="noopener">夜幕爬虫安全论坛</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/zvc3w.jpg">
                  </span>
                  <span class="link">
                    <a href="https://www.weishidong.com/" target="_blank" rel="noopener">韦世东的技术专栏</a>
                  </span>
                </li>
                <li class="friend">
                  <span class="logo">
                    <img src="https://qiniu.cuiqingcai.com/ebudy.jpg">
                  </span>
                  <span class="link">
                    <a href="https://chuanjiabing.com/" target="_blank" rel="noopener">穿甲兵技术社区</a>
                  </span>
                </li>
              </ul>
            </div>
          </div>
        </aside>
        <div id="sidebar-dimmer"></div>
      </div>
    </main>
    <footer class="footer">
      <div class="footer-inner">
        <div class="copyright"> &copy; <span itemprop="copyrightYear">2021</span>
          <span class="with-love">
            <i class="fa fa-heart"></i>
          </span>
          <span class="author" itemprop="copyrightHolder">崔庆才丨静觅</span>
          <span class="post-meta-divider">|</span>
          <span class="post-meta-item-icon">
            <i class="fa fa-chart-area"></i>
          </span>
          <span title="站点总字数">2.6m</span>
          <span class="post-meta-divider">|</span>
          <span class="post-meta-item-icon">
            <i class="fa fa-coffee"></i>
          </span>
          <span title="站点阅读时长">39:54</span>
        </div>
        <div class="powered-by">由 <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> & <a href="https://pisces.theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Pisces</a> 强力驱动 </div>
        <div class="beian"><a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">京ICP备18015597号-1 </a>
        </div>
        <script>
          (function ()
          {
            function leancloudSelector(url)
            {
              url = encodeURI(url);
              return document.getElementById(url).querySelector('.leancloud-visitors-count');
            }

            function addCount(Counter)
            {
              var visitors = document.querySelector('.leancloud_visitors');
              var url = decodeURI(visitors.id);
              var title = visitors.dataset.flagTitle;
              Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify(
              {
                url
              }))).then(response => response.json()).then((
              {
                results
              }) =>
              {
                if (results.length > 0)
                {
                  var counter = results[0];
                  leancloudSelector(url).innerText = counter.time + 1;
                  Counter('put', '/classes/Counter/' + counter.objectId,
                  {
                    time:
                    {
                      '__op': 'Increment',
                      'amount': 1
                    }
                  }).catch(error =>
                  {
                    console.error('Failed to save visitor count', error);
                  });
                }
                else
                {
                  Counter('post', '/classes/Counter',
                  {
                    title,
                    url,
                    time: 1
                  }).then(response => response.json()).then(() =>
                  {
                    leancloudSelector(url).innerText = 1;
                  }).catch(error =>
                  {
                    console.error('Failed to create', error);
                  });
                }
              }).catch(error =>
              {
                console.error('LeanCloud Counter Error', error);
              });
            }

            function showTime(Counter)
            {
              var visitors = document.querySelectorAll('.leancloud_visitors');
              var entries = [...visitors].map(element =>
              {
                return decodeURI(element.id);
              });
              Counter('get', '/classes/Counter?where=' + encodeURIComponent(JSON.stringify(
              {
                url:
                {
                  '$in': entries
                }
              }))).then(response => response.json()).then((
              {
                results
              }) =>
              {
                for (let url of entries)
                {
                  let target = results.find(item => item.url === url);
                  leancloudSelector(url).innerText = target ? target.time : 0;
                }
              }).catch(error =>
              {
                console.error('LeanCloud Counter Error', error);
              });
            }
            let
            {
              app_id,
              app_key,
              server_url
            } = {
              "enable": true,
              "app_id": "6X5dRQ0pnPWJgYy8SXOg0uID-gzGzoHsz",
              "app_key": "ziLDVEy73ne5HtFTiGstzHMS",
              "server_url": "https://6x5drq0p.lc-cn-n1-shared.com",
              "security": false
            };

            function fetchData(api_server)
            {
              var Counter = (method, url, data) =>
              {
                return fetch(`${api_server}/1.1${url}`,
                {
                  method,
                  headers:
                  {
                    'X-LC-Id': app_id,
                    'X-LC-Key': app_key,
                    'Content-Type': 'application/json',
                  },
                  body: JSON.stringify(data)
                });
              };
              if (CONFIG.page.isPost)
              {
                if (CONFIG.hostname !== location.hostname) return;
                addCount(Counter);
              }
              else if (document.querySelectorAll('.post-title-link').length >= 1)
              {
                showTime(Counter);
              }
            }
            let api_server = app_id.slice(-9) !== '-MdYXbMMI' ? server_url : `https://${app_id.slice(0, 8).toLowerCase()}.api.lncldglobal.com`;
            if (api_server)
            {
              fetchData(api_server);
            }
            else
            {
              fetch('https://app-router.leancloud.cn/2/route?appId=' + app_id).then(response => response.json()).then((
              {
                api_server
              }) =>
              {
                fetchData('https://' + api_server);
              });
            }
          })();

        </script>
      </div>
      <div class="footer-stat">
        <span id="cnzz_stat_icon_1279355174"></span>
        <script type="text/javascript">
          document.write(unescape("%3Cspan id='cnzz_stat_icon_1279355174'%3E%3C/span%3E%3Cscript src='https://v1.cnzz.com/z_stat.php%3Fid%3D1279355174%26online%3D1%26show%3Dline' type='text/javascript'%3E%3C/script%3E"));

        </script>
      </div>
    </footer>
  </div>
  <script src="//cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js"></script>
  <script src="//cdn.jsdelivr.net/npm/pangu@4/dist/browser/pangu.min.js"></script>
  <script src="/js/utils.js"></script>
  <script src="/.js"></script>
  <script src="/js/schemes/pisces.js"></script>
  <script src="/.js"></script>
  <script src="/js/next-boot.js"></script>
  <script src="/.js"></script>
  <script>
    (function ()
    {
      var canonicalURL, curProtocol;
      //Get the <link> tag
      var x = document.getElementsByTagName("link");
      //Find the last canonical URL
      if (x.length > 0)
      {
        for (i = 0; i < x.length; i++)
        {
          if (x[i].rel.toLowerCase() == 'canonical' && x[i].href)
          {
            canonicalURL = x[i].href;
          }
        }
      }
      //Get protocol
      if (!canonicalURL)
      {
        curProtocol = window.location.protocol.split(':')[0];
      }
      else
      {
        curProtocol = canonicalURL.split(':')[0];
      }
      //Get current URL if the canonical URL does not exist
      if (!canonicalURL) canonicalURL = window.location.href;
      //Assign script content. Replace current URL with the canonical URL
      ! function ()
      {
        var e = /([http|https]:\/\/[a-zA-Z0-9\_\.]+\.baidu\.com)/gi,
          r = canonicalURL,
          t = document.referrer;
        if (!e.test(r))
        {
          var n = (String(curProtocol).toLowerCase() === 'https') ? "https://sp0.baidu.com/9_Q4simg2RQJ8t7jm9iCKT-xh_/s.gif" : "//api.share.baidu.com/s.gif";
          t ? (n += "?r=" + encodeURIComponent(document.referrer), r && (n += "&l=" + r)) : r && (n += "?l=" + r);
          var i = new Image;
          i.src = n
        }
      }(window);
    })();

  </script>
  <script src="/js/local-search.js"></script>
  <script src="/.js"></script>
</body>

</html>
